Visitar URL original
bpo-35588: Speed up mod, divmod and floordiv operations for Fraction type by scoder · Pull Request #11322 · python/cpython · GitHub
The Wayback Machine - https://web.archive.org/web/20220822093758/https://github.com/python/cpython/pull/11322
Skip to content
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

bpo-35588: Speed up mod, divmod and floordiv operations for Fraction type #11322

Merged
merged 11 commits into from Jan 2, 2019

Conversation

scoder
Copy link
Contributor

@scoder scoder commented Dec 26, 2018 •

Implement mod and divmod operations for Fraction type by spelling out the numerator/denominator calculation, instead of instantiating and normalising Fractions along the way. This speeds up '%' and divmod() by 2-3x.

https://bugs.python.org/issue35588

…pelling out the numerator/denominator calculation, instead of instantiating and normalising Fractions along the way. This speeds up '%' and divmod() by 2-3x.
@scoder scoder force-pushed the bpo35588-fraction-divmod branch from a8607eb to 7a624bf Compare Dec 26, 2018
@scoder scoder changed the title bpo-35588: Speed up mod and divmod operations for Fraction type bpo-35588: Speed up mod, divmod and floordiv operations for Fraction type Dec 26, 2018
Lib/fractions.py Outdated Show resolved Hide resolved
Lib/fractions.py Outdated Show resolved Hide resolved
Lib/fractions.py Outdated Show resolved Hide resolved
Co-Authored-By: scoder <stefan_ml@behnel.de>
Lib/fractions.py Outdated Show resolved Hide resolved
Lib/fractions.py Outdated Show resolved Hide resolved
Lib/fractions.py Outdated Show resolved Hide resolved
Lib/fractions.py Show resolved Hide resolved
Lib/fractions.py Outdated Show resolved Hide resolved
Lib/test/test_fractions.py Outdated Show resolved Hide resolved
Lib/test/test_fractions.py Show resolved Hide resolved
@asvetlov
Copy link
Contributor

asvetlov commented Dec 27, 2018

@serhiy-storchaka the patch looks great for me.
I'd like to merge it in a day or two if nobody objects.

eamanu
eamanu approved these changes Dec 27, 2018
Copy link
Contributor

@eamanu eamanu left a comment

LGTM. @asvetlov I think is ready to merge.

@serhiy-storchaka
Copy link
Member

serhiy-storchaka commented Dec 29, 2018

I'll merge this PR after New Year if @rhettinger and @mdickinson do not have objections.

@serhiy-storchaka serhiy-storchaka merged commit 3a374e0 into python:master Jan 2, 2019
5 checks passed
@bedevere-bot
Copy link

bedevere-bot commented Jan 2, 2019

@serhiy-storchaka: Please replace # with GH- in the commit message next time. Thanks!

@serhiy-storchaka
Copy link
Member

serhiy-storchaka commented Jan 2, 2019

Due to some GitHub bug my edition of the commit message was ignored, and changes were committed with an awful commit message.

@serhiy-storchaka serhiy-storchaka removed their assignment Mar 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants