Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork11k
MNT: disable the coercion cache for the nogil build#26294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Maybe this is all just noise?
The reduction changes must be noise. Thearray([1])
is exactly the type of operation that would benefit, so that must be real (also if it was noise you would expect other small array benchmarks to also fluctuate stronger).
If you would havearray([[1]])
or so (i.e. deeper nested and maybe even containing further arrays likearray([[small_arr], [small_arr]])
) the benefit should be bigger.
I might have timed the benefit of the discovery step on its own also when adding it (so the benefit in percent is bigger compared to full coercion).
Anyway, we can definitely just disable it in the nogil build I think. It may be a nice boost for some code, but overall will have less impact than dropping the small array cache.
I tried testing scikit-learn yesterday and found that parallel forest training led to a similar seg fault and I was able to reduce it down to the test I just added. I decided it's worth having a |
38e3e0f
to9fce93a
Compare11eecb7
to1d976fc
ComparePulling this in, if someone has an issue with the new test file I’ll do a followup. |
This disables the coercion cache on the nogil build, but I'd like to find a benchmark that shows the benefit of this cache more than what's already in
bench_array_coercion.py
andbench_core.py
.I don't see any significant performance impact before or after this change, although note that I can't actually run asv in comparison mode yet in the nogil build.
When I disable this cache for the single-threaded build (e.g. set
COERCION_CACHE_CACHE_SIZE
to 0 in both branches of the ifdef) where Ican run asv in comparison mode, I get the following results:So it does have a small, ~5% benefit for a few of the array coercion tests, but a somewhat confusing mix of performance improvements and performance hits for reduction operations, and two other 10% performance hits for creating an array from a single-element list and a benchmark for
count_nonzero
withaxis
set.Maybe this is all just noise?