Restore (or beat) Python 2 performance for arithmetic operations on ints that fit into a single word
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 15/100
- Issue type
- Refactor
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- python
- Domain
- backend, performance
Research direction
Start with the fuller discussion in faster-cpython/ideas#548, then review the linked pull requests gh-101292, gh-101685, gh-102464, gh-104742, gh-104759, gh-107388, gh-107392, gh-125384, gh-125407, and gh-125408. Done would mean a new int/long object layout that restores or exceeds Python 2 performance for arithmetic on single-word integers.
Written by the indexing model from the issue text.
Description
In Python 2 ints and longs were different objects, and the design of each was tailored to the different size and use cases.
In Python3 we dropped the distinction, but we also dropped the design for ints that fit into a single word.
We have added various fast paths for "medium" integers (e.g. https://github.com/python/cpython/issues/89109) but the underlying data structure gets in the way.
We should layout the int/long object so that it supports fast operations for most integers.
See https://github.com/faster-cpython/ideas/issues/548 for a fuller discussion
Linked PRs
- gh-101292
- gh-101685
- gh-102464
- gh-104742
- gh-104759
- gh-107388
- gh-107392
- gh-125384
- gh-125407
- gh-125408
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 36k
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 558
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from python/cpython
-
docs pending
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
stdlib type-feature
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
stdlib type-feature
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
build type-bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
stdlib topic-email type-feature
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
qgis/QGIS-Documentation#11275 ·
-
bug priority:normal ready-for-dev
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
OpenHands/extensions#626 · 1 comment ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
CSCfi/sd-search-api#39 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
StevenBlack/hosts#3255 ·