MNT: disable the coercion cache for the nogil build#26294
MNT: disable the coercion cache for the nogil build#26294ngoldbaum merged 3 commits intonumpy:mainfrom
Conversation
seberg
left a comment
There was a problem hiding this comment.
Maybe this is all just noise?
The reduction changes must be noise. The array([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 have array([[1]]) or so (i.e. deeper nested and maybe even containing further arrays like array([[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 to
9fce93a
Compare
11eecb7 to
1d976fc
Compare
|
Pulling 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.pyandbench_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_SIZEto 0 in both branches of the ifdef) where I can 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_nonzerowithaxisset.Maybe this is all just noise?