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 round_size for rehashing #86839

Closed
jneb mannequin opened this issue Dec 18, 2020 · 6 comments
Closed

Optimize round_size for rehashing #86839

jneb mannequin opened this issue Dec 18, 2020 · 6 comments
Labels
3.10 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) performance Performance or resource usage

Comments

@jneb
Copy link
Mannequin

jneb mannequin commented Dec 18, 2020

BPO 42673
Nosy @jneb, @serhiy-storchaka, @jstasiak, @akulakov
PRs
  • bpo-42673 prevent branch misprediction in round_size (used in rehash) #23833
  • 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 = None
    closed_at = <Date 2021-12-23.23:20:55.583>
    created_at = <Date 2020-12-18.09:35:27.357>
    labels = ['interpreter-core', '3.10', 'performance']
    title = 'Optimize round_size for rehashing'
    updated_at = <Date 2021-12-23.23:20:55.580>
    user = 'https://github.com/jneb'

    bugs.python.org fields:

    activity = <Date 2021-12-23.23:20:55.580>
    actor = 'andrei.avk'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-12-23.23:20:55.583>
    closer = 'andrei.avk'
    components = ['Interpreter Core']
    creation = <Date 2020-12-18.09:35:27.357>
    creator = 'jneb'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 42673
    keywords = ['patch']
    message_count = 6.0
    messages = ['383291', '383294', '383302', '383991', '384017', '409112']
    nosy_count = 4.0
    nosy_names = ['jneb', 'serhiy.storchaka', 'jstasiak', 'andrei.avk']
    pr_nums = ['23833']
    priority = 'normal'
    resolution = 'rejected'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'performance'
    url = 'https://bugs.python.org/issue42673'
    versions = ['Python 3.10']

    @jneb
    Copy link
    Mannequin Author

    jneb mannequin commented Dec 18, 2020

    There's a trivial optimization in the round_size in hashtable.c:
    a loop is used to compute the lowest power of two >= s,
    while this can be done in one step with bit_length.
    I am making a pull request for this.

    @jneb jneb mannequin added 3.10 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) performance Performance or resource usage labels Dec 18, 2020
    @serhiy-storchaka
    Copy link
    Member

    Do you have any benchmarks?

    @jstasiak
    Copy link
    Mannequin

    jstasiak mannequin commented Dec 18, 2020

    I'd be especially curious about branch (mis)prediction stats before and after applying this patch – including such information seems necessary in a patch that's about optimization.

    @serhiy-storchaka
    Copy link
    Member

    Since no benchmarking data was provided, I suggest to close this issue. We do not accept optimization changes without evidences of performance boost.

    @jneb
    Copy link
    Mannequin Author

    jneb mannequin commented Dec 29, 2020

    Harsh, but fair.
    I'll do a better job next time!

    Op di 29 dec. 2020 13:42 schreef Serhiy Storchaka <report@bugs.python.org>:

    Serhiy Storchaka <storchaka+cpython@gmail.com> added the comment:

    Since no benchmarking data was provided, I suggest to close this issue. We
    do not accept optimization changes without evidences of performance boost.

    ----------
    status: open -> pending


    Python tracker <report@bugs.python.org>
    <https://bugs.python.org/issue42673\>


    @akulakov
    Copy link
    Contributor

    Closing as it sounds like OP agreed to it in the last msg; and no benchmarking was provided.

    @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.10 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

    2 participants