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.

Title: Optimize mod division for ints
Type: performance Stage: resolved
Components: Interpreter Core Versions: Python 3.6
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: yselivanov Nosy List: mark.dickinson, python-dev, serhiy.storchaka, vstinner, yselivanov
Priority: normal Keywords: patch

Created on 2016-02-08 22:31 by yselivanov, last changed 2022-04-11 14:58 by admin. This issue is now closed.

File name Uploaded Description Edit
mod_div.patch yselivanov, 2016-02-08 22:31 review
Messages (4)
msg259897 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2016-02-08 22:31
The attached patch implements fast path for modulo division of single digit longs.

Some timeit micro-benchmarks: 

-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.213 usec
without patch: 0.602 usec
msg259898 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2016-02-08 22:35
See also issue #21955.
msg260045 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2016-02-10 22:14
Is this patch is a subset of issue #26289 patch?
msg260111 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-02-11 15:27
New changeset 37bacf3fa1f5 by Yury Selivanov in branch 'default':
Issues #26289 and #26315: Optimize floor/modulo div for single-digit longs
Date User Action Args
2022-04-11 14:58:27adminsetgithub: 70503
2016-02-11 15:27:35yselivanovsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2016-02-11 15:27:00python-devsetnosy: + python-dev
messages: + msg260111
2016-02-10 22:14:09vstinnersetmessages: + msg260045
2016-02-09 20:13:42mark.dickinsonsetnosy: + mark.dickinson
2016-02-08 22:35:45vstinnersetmessages: + msg259898
2016-02-08 22:31:15yselivanovcreate