Thanks for your reply, actually when I just test 1-d array by xt::mean and np.mean, if the 1-d array is a little large, xt::mean will also be very slow than np.mean. The demo code as following:
As a reference, I am experimenting with running benchmarking to get on top of this in the future : xtensor-stack/xtensor-python#288 . At the moment it is not completely obvious how to distinguish the cost of the pybind11 binding from the actual performance issues of xtensor. If you are interested to contribute you are more than welcome
Activity
OUCyf commented on Apr 6, 2023
BTW I want to add OpenMP to for loop, that's the reason why I need a loop.
tdegeus commented on Apr 7, 2023
It is probably xt::view that make it slow. What about doing the same as in NumPy? Probably
data -= xt::mean(data, 1);(unchecked)
OUCyf commented on Apr 7, 2023
Thanks for your reply, actually when I just test 1-d array by xt::mean and np.mean, if the 1-d array is a little large, xt::mean will also be very slow than np.mean. The demo code as following:
xt::xarray data={1,2,3........100000}; xt::mean(data);But numpy is very fast.
I will give you a full test later, and I do need to use xt::mean in my code.
tdegeus commented on Apr 7, 2023
That's a bit surprising. How did you compile? How much slower?
tdegeus commented on Apr 11, 2023
As a reference, I am experimenting with running benchmarking to get on top of this in the future : xtensor-stack/xtensor-python#288 . At the moment it is not completely obvious how to distinguish the cost of the pybind11 binding from the actual performance issues of xtensor. If you are interested to contribute you are more than welcome