GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Missing fast path in PyLong_From*() functions for compact integers · Issue #129149 · python/cpython

Missing fast path in PyLong_From*() functions for compact integers #129149

New issue
Copy link
New issue
Copy link
Closed
Closed
Missing fast path in PyLong_From*() functions for compact integers#129149
Copy link
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)performancePerformance or resource usagePerformance or resource usagetype-featureA feature request or enhancementA feature request or enhancement

Description

@chris-eibl
chris-eibl
opened on Jan 21, 2025
Issue body actions

Feature or enhancement

Proposal:

See e.g. the fast path using_PyLong_FromMedium() in PyLong_FromLong(). PyLong_FromLongLong() is almost identical.

Maybe then implement PyLong_FromSsize_t(), PyLong_FromLong() and PyLong_FromLongLong()) using a macro similar to PYLONG_FROM_UINT to get rid of the repetitive code?

PYLONG_FROM_UINT is missing the fast path for medium values, too.

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

Per encouragement from @iritkatriel in #128927 (comment)

Linked PRs

  • gh-129149: Add Missing fast path in PYLONG_FROM_UINT macro for compact integers #129168
  • gh-129149: Create a macro PYLONG_FROM_SIGNED, and leverage it in functions  #129215
  • gh-129149: Add fast path for medium-size integers in PyLong_FromSsize_t() #129301
  • GH-129149: Add fast paths to four more PyLong_From* functions #131211

Activity

  1. chris-eibl
    added
    type-featureA feature request or enhancementA feature request or enhancement
    on Jan 21, 2025
  2. picnixz
    added
    performancePerformance or resource usagePerformance or resource usage
    interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)
    on Jan 21, 2025
  3. picnixz
    changed the title [-]PyLong_FromSsize_t(), PyLong_FromUnsignedLong(), PyLong_FromUnsignedLong() and PyLong_FromSize_t() miss the fast path for compact integers[/-] [+]Missing fast path in PyLong_From*() functions for compact integers[/+] on Jan 21, 2025
  4. chris-eibl commented on Jan 21, 2025

    @chris-eibl
    chris-eibl
    on Jan 21, 2025
    MemberAuthor
    More actions

    PyLong_FromInt32(), PyLong_FromUInt32(), PyLong_FromInt64 and PyLong_FromUInt64() could maybe use these macros, too.
    They do "the same thing" in a totally different way ...
    PR is here #131211, and would also give us some nicely speed ups.

  5. vstinner
    added a commit that references this issue on Jan 23, 2025

    gh-129149: Add fast path in PYLONG_FROM_UINT macro for compact intege…

    ab353b3
  6. chris-eibl
    added a commit that references this issue on Jan 25, 2025

    pythongh-129149: add macro PYLONG_FROM_INT

    37bddee
  7. skirpichev
    added a commit that references this issue on Jan 26, 2025

    Merge branch 'main' into pythongh-129149

    3a5152f
  8. chris-eibl
    added a commit that references this issue on Jan 29, 2025

    Merge branch 'main' into pythongh-129149

    8331f8b
  9. chris-eibl
    added a commit that references this issue on Mar 1, 2025

    Merge branch 'main' into pythongh-129149

    fda2844
  10. chris-eibl
    added a commit that references this issue on Mar 12, 2025

    Merge branch 'main' into pythongh-129149

    89ee42b
  11. picnixz
    added a commit that references this issue on Mar 13, 2025

    gh-129149: Add fast path for medium-sized integers in `PyLong_FromSsi…

    119bcfa
  12. plashchynski
    added a commit that references this issue on Mar 17, 2025

    pythongh-129149: Add fast path for medium-sized integers in `PyLong_F…

    f28691f
  13. picnixz
    added a commit that references this issue on Mar 30, 2025

    GH-129149: Add fast path for medium-sized integers in `PyLong_From*` …

    a175d64
  14. picnixz
    closed this as completedon Mar 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)performancePerformance or resource usagePerformance or resource usagetype-featureA feature request or enhancementA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.