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
The python range object contains code to compute the length from the start, stop and step values. This calculation is performed with PyLong objects which is expensive. We can add a fast path for the common case where start, stop and step all fit into a long value.
Pitch
Benchmark results are in the PR.
The range object itself is often converted to a range iterator. For the iterator object there already is a fast version (the the method fast_range_iter). A further optimization could be achieved by creating a specialized range object that can construct the fast range iterator without conversions to PyLong, but this is much more involved.
…egers (#100810)
Use C long arithmetic instead of PyLong arithmetic to compute the range length, where possible.
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Mark Dickinson <[email protected]>
Feature or enhancement
The python
range
object contains code to compute the length from the start, stop and step values. This calculation is performed withPyLong
objects which is expensive. We can add a fast path for the common case where start, stop and step all fit into a long value.Pitch
Benchmark results are in the PR.
The range object itself is often converted to a range iterator. For the iterator object there already is a fast version (the the method fast_range_iter). A further optimization could be achieved by creating a specialized range object that can construct the fast range iterator without conversions to
PyLong
, but this is much more involved.Linked PRs
The text was updated successfully, but these errors were encountered: