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

Minor speedup for bigint squaring #90391

Closed
tim-one opened this issue Jan 2, 2022 · 2 comments
Closed

Minor speedup for bigint squaring #90391

tim-one opened this issue Jan 2, 2022 · 2 comments
Assignees
Labels
3.11 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) performance Performance or resource usage

Comments

@tim-one
Copy link
Member

tim-one commented Jan 2, 2022

BPO 46233
Nosy @tim-one
PRs
  • bpo-46233: Minor speedup for bigint squaring #30345
  • 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/tim-one'
    closed_at = <Date 2022-01-04.02:43:20.811>
    created_at = <Date 2022-01-02.22:48:26.766>
    labels = ['interpreter-core', '3.11', 'performance']
    title = 'Minor speedup for bigint squaring'
    updated_at = <Date 2022-01-04.02:43:20.810>
    user = 'https://github.com/tim-one'

    bugs.python.org fields:

    activity = <Date 2022-01-04.02:43:20.810>
    actor = 'tim.peters'
    assignee = 'tim.peters'
    closed = True
    closed_date = <Date 2022-01-04.02:43:20.811>
    closer = 'tim.peters'
    components = ['Interpreter Core']
    creation = <Date 2022-01-02.22:48:26.766>
    creator = 'tim.peters'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 46233
    keywords = ['patch']
    message_count = 2.0
    messages = ['409534', '409645']
    nosy_count = 1.0
    nosy_names = ['tim.peters']
    pr_nums = ['30345']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'performance'
    url = 'https://bugs.python.org/issue46233'
    versions = ['Python 3.11']

    @tim-one
    Copy link
    Member Author

    tim-one commented Jan 2, 2022

    longobject.c's x_mul()'s special code for squaring gets kind of sloppy at the end of a digit pass, doing a useless add of 0 and an "extra" test for carry. Easily cleaned up.

    I think the underlying cause is that the HAC algorithm description it was modeled on was quite "hand wavy" about how badly, and exactly when, the carry can exceed a single digit. Things are better-behaved at the end of a digit pass.

    @tim-one tim-one added the 3.11 only security fixes label Jan 2, 2022
    @tim-one tim-one self-assigned this Jan 2, 2022
    @tim-one tim-one added interpreter-core (Objects, Python, Grammar, and Parser dirs) performance Performance or resource usage 3.11 only security fixes labels Jan 2, 2022
    @tim-one tim-one self-assigned this Jan 2, 2022
    @tim-one tim-one added interpreter-core (Objects, Python, Grammar, and Parser dirs) performance Performance or resource usage labels Jan 2, 2022
    @tim-one
    Copy link
    Member Author

    tim-one commented Jan 4, 2022

    New changeset 3aa5242 by Tim Peters in branch 'main':
    bpo-46233: Minor speedup for bigint squaring (GH-30345)
    3aa5242

    @tim-one tim-one closed this as completed Jan 4, 2022
    @tim-one tim-one closed this as completed Jan 4, 2022
    @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
    3.11 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) performance Performance or resource usage
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant