This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author yselivanov
Recipients mark.dickinson, pitrou, serhiy.storchaka, vstinner, yselivanov
Date 2016-02-09.21:57:49
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1455055069.37.0.805945112098.issue26289@psf.upfronthosting.co.za>
In-reply-to
Content
> 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?
History
Date User Action Args
2016-02-09 21:57:49yselivanovsetrecipients: + yselivanov, mark.dickinson, pitrou, vstinner, serhiy.storchaka
2016-02-09 21:57:49yselivanovsetmessageid: <1455055069.37.0.805945112098.issue26289@psf.upfronthosting.co.za>
2016-02-09 21:57:49yselivanovlinkissue26289 messages
2016-02-09 21:57:49yselivanovcreate