Open zhujun98 opened 4 years ago
Hi @zhujun98! Thanks for the bug report.
Indeed there is a problem with the performance of mean.
We have a fix in this PR: https://github.com/QuantStack/xtensor/pull/1627
I think I will take out the fix for mean by the beginning of next week so that we have that ready to go since the PR is blocked on some TBB issues that were not that straightforward to fix unfortunately.
Cheers!
In Python I have a 3D numpy array which is a stack of image data and I would like to calculate
nanmean
. I tried two different ways using xtensor-python:and benchmarked with the following Python code:
The result is
I guess the first one is faster because
xt::nanmean
usesxt::nansum
,xt::count_nonnan
which needs to loop over the big array twice. Alsoxt::count_nonnan
is twice as expensive asxt::nansum
for whatever reason. I compilextensor
withxsimd
and do not see any improvement. But I am quite new toxsimd
and not sure whether I did everything correctly.I would like to further improve the performance by using
tbb
. I am not sure whether it is the best way to go and would like to ask your opinion. Thanks a lot!