-
-
Notifications
You must be signed in to change notification settings - Fork 30.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integer operations are inefficient for "medium" integers. #89109
Comments
"Medium" integers are those with a single internal digit or zero. To a good approximation, all integers are "medium". However, we make little effort to exploit that fact in the code for binary operations, which are very common operations on integers. |
We already special-case medium integers in the Objects/longobject.c code, in various places. For example for addition, here: Lines 3070 to 3072 in 3240bc6
Are you proposing further changes in longobject.c, or some other mechanism? |
See also bpo-21955, bpo-10044, and Lines 1986 to 1991 in 3240bc6
|
Just changes to longobject.c. There are still various minor inefficiencies in testing to see whether an int is a medium value, and then throwing away size information before creating result objects. I'm not expecting this to make much difference, but every little helps. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: