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

Optimize mod division for ints #70503

Closed
1st1 opened this issue Feb 8, 2016 · 4 comments
Closed

Optimize mod division for ints #70503

1st1 opened this issue Feb 8, 2016 · 4 comments
Assignees
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) performance Performance or resource usage

Comments

@1st1
Copy link
Member

1st1 commented Feb 8, 2016

BPO 26315
Nosy @mdickinson, @vstinner, @serhiy-storchaka, @1st1
Files
  • mod_div.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/1st1'
    closed_at = <Date 2016-02-11.15:27:35.633>
    created_at = <Date 2016-02-08.22:31:15.807>
    labels = ['interpreter-core', 'performance']
    title = 'Optimize mod division for ints'
    updated_at = <Date 2016-02-11.15:27:35.632>
    user = 'https://github.com/1st1'

    bugs.python.org fields:

    activity = <Date 2016-02-11.15:27:35.632>
    actor = 'yselivanov'
    assignee = 'yselivanov'
    closed = True
    closed_date = <Date 2016-02-11.15:27:35.633>
    closer = 'yselivanov'
    components = ['Interpreter Core']
    creation = <Date 2016-02-08.22:31:15.807>
    creator = 'yselivanov'
    dependencies = []
    files = ['41861']
    hgrepos = []
    issue_num = 26315
    keywords = ['patch']
    message_count = 4.0
    messages = ['259897', '259898', '260045', '260111']
    nosy_count = 5.0
    nosy_names = ['mark.dickinson', 'vstinner', 'python-dev', 'serhiy.storchaka', 'yselivanov']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'performance'
    url = 'https://bugs.python.org/issue26315'
    versions = ['Python 3.6']

    @1st1
    Copy link
    Member Author

    1st1 commented Feb 8, 2016

    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

    @1st1 1st1 self-assigned this Feb 8, 2016
    @1st1 1st1 added interpreter-core (Objects, Python, Grammar, and Parser dirs) performance Performance or resource usage labels Feb 8, 2016
    @vstinner
    Copy link
    Member

    vstinner commented Feb 8, 2016

    See also issue bpo-21955.

    @vstinner
    Copy link
    Member

    Is this patch is a subset of issue bpo-26289 patch?

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Feb 11, 2016

    New changeset 37bacf3fa1f5 by Yury Selivanov in branch 'default':
    Issues bpo-26289 and bpo-26315: Optimize floor/modulo div for single-digit longs
    https://hg.python.org/cpython/rev/37bacf3fa1f5

    @1st1 1st1 closed this as completed Feb 11, 2016
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    interpreter-core (Objects, Python, Grammar, and Parser dirs) performance Performance or resource usage
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants