Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Optimize Python range object for small integers #100726

Closed
Labels
performancePerformance or resource usagetype-featureA feature request or enhancement
@eendebakpt

Description

@eendebakpt

Feature or enhancement

The pythonrange 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 methodfast_range_iter). A further optimization could be achieved by creating a specialized range object that can construct the fast range iterator without conversions toPyLong, but this is much more involved.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    performancePerformance or resource usagetype-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp