Message259955
> mod = left % right if size_a == size_b else right - 1 - (left - 1) % right
This works, Mark! Again, the difference in performance is very subtle, but the code is more compact.
-m timeit -s "x=22331" "x//2;x//-3;x//4;x//5;x//-6;x//7;x//8;x//-99;x//100;"
with patch: 0.321 without patch: 0.633
-m timeit -s "x=22331" "x%2;x%3;x%-4;x%5;x%6;x%-7;x%8;x%99;x%-100;"
with patch: 0.224 without patch: 0.66
-m timeit "divmod(100,20);divmod(7,3);divmod(121,99);divmod(123121,123);divmod(-1000,7);divmod(23423,-111)"
with patch: 0.839 without patch: 1.07
I'm in favour of fast_divmod_2.patch for solving both this issue and issue #26315. Serhiy, what do you think? |
|
Date |
User |
Action |
Args |
2016-02-09 21:57:49 | yselivanov | set | recipients:
+ yselivanov, mark.dickinson, pitrou, vstinner, serhiy.storchaka |
2016-02-09 21:57:49 | yselivanov | set | messageid: <1455055069.37.0.805945112098.issue26289@psf.upfronthosting.co.za> |
2016-02-09 21:57:49 | yselivanov | link | issue26289 messages |
2016-02-09 21:57:49 | yselivanov | create | |
|