You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently RangeIndex.max and RangeIndex.min fallback to nanops.nanmax and nanops.nanmin, but it's possible to determine these more efficiently using properties of RangeIndex.
I don't imagine that these are used very frequently, but the implementation is straightforward and appears to yield a good performance boost, so seems worthwhile. Wanted to check here first before putting in too much effort though.
Did a preliminary implementation and created some asv benchmarks:
before after ratio
[b59f107a] [85c7fef1]
- 29.3±0ms 1.74±0.06μs 0.00 index_object.Range.time_max
- 27.3±1ms 1.39±0.06μs 0.00 index_object.Range.time_min
- 24.6±0ms 1.18±0.08μs 0.00 index_object.Range.time_min_trivial
- 27.3±0.7ms 1.15±0.04μs 0.00 index_object.Range.time_max_trivial
SOME BENCHMARKS HAVE CHANGED SIGNIFICANTLY.
Note that the _trivial suffix denotes a fastpath for when the max/min are just the _start value (e.g. the minimum value of an increasing RangeIndex is just _start). This isn't necessarily the case with _stop, as it may not be included if misaligned with _step (e.g. RangeIndex(0, 10, 3)).
The text was updated successfully, but these errors were encountered:
Problem description
Currently
RangeIndex.max
andRangeIndex.min
fallback tonanops.nanmax
andnanops.nanmin
, but it's possible to determine these more efficiently using properties ofRangeIndex
.I don't imagine that these are used very frequently, but the implementation is straightforward and appears to yield a good performance boost, so seems worthwhile. Wanted to check here first before putting in too much effort though.
Did a preliminary implementation and created some asv benchmarks:
Where the benchmarks are generated from:
Note that the
_trivial
suffix denotes a fastpath for when the max/min are just the_start
value (e.g. the minimum value of an increasingRangeIndex
is just_start
). This isn't necessarily the case with_stop
, as it may not be included if misaligned with_step
(e.g.RangeIndex(0, 10, 3)
).The text was updated successfully, but these errors were encountered: