]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-43420: Simple optimizations for Fraction's arithmetics (GH-24779)
authorSergey B Kirpichev <2155800+skirpichev@users.noreply.github.com>
Mon, 22 Mar 2021 02:30:55 +0000 (05:30 +0300)
committerGitHub <noreply@github.com>
Mon, 22 Mar 2021 02:30:55 +0000 (21:30 -0500)
commit690aca781152a498f5117682524d2cd9aa4d7657
tree5b25204630ca11818548c21d1badad433a84f819
parent9a50ef43e42ee32450a81ce13ed5a0729d3b84e8
bpo-43420: Simple optimizations for Fraction's arithmetics (GH-24779)

bpo-43420: Implement standard transformations in + - * / that can often reduce the size of intermediate integers needed. For rationals with large components, this can yield dramatic speed improvements, but for small rationals can run 10-20% slower, due to increased fixed overheads in the longer-winded code. If those slowdowns turn out to be a problem, see the PR discussion for low-level implementation tricks that could cut other fixed overheads.

Co-authored-by: Tim Peters <tim.peters@gmail.com>
Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
Lib/fractions.py
Lib/test/test_fractions.py
Misc/ACKS
Misc/NEWS.d/next/Library/2021-03-07-08-03-31.bpo-43420.cee_X5.rst [new file with mode: 0644]