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

Use PEP 590 vectorcall to speed up calls to bool() #86036

Closed
corona10 opened this issue Sep 27, 2020 · 9 comments
Closed

Use PEP 590 vectorcall to speed up calls to bool() #86036

corona10 opened this issue Sep 27, 2020 · 9 comments
Assignees
Labels
3.10 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) performance Performance or resource usage

Comments

@corona10
Copy link
Member

BPO 41870
Nosy @vstinner, @markshannon, @corona10, @pablogsal
PRs
  • bpo-41870: Use PEP 590 vectorcall to speed up bool()  #22427
  • bpo-41870: Avoid the test when nargs=0 #22462
  • bpo-41870: Update What's News 3.10 about vectorcall #25219
  • Files
  • bench_bool.py
  • 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/corona10'
    closed_at = <Date 2020-10-01.04:52:35.737>
    created_at = <Date 2020-09-27.13:20:58.342>
    labels = ['interpreter-core', '3.10', 'performance']
    title = 'Use PEP 590 vectorcall to speed up calls to bool()'
    updated_at = <Date 2021-04-06.15:44:07.015>
    user = 'https://github.com/corona10'

    bugs.python.org fields:

    activity = <Date 2021-04-06.15:44:07.015>
    actor = 'corona10'
    assignee = 'corona10'
    closed = True
    closed_date = <Date 2020-10-01.04:52:35.737>
    closer = 'corona10'
    components = ['Interpreter Core']
    creation = <Date 2020-09-27.13:20:58.342>
    creator = 'corona10'
    dependencies = []
    files = ['49475']
    hgrepos = []
    issue_num = 41870
    keywords = ['patch']
    message_count = 9.0
    messages = ['377565', '377605', '377606', '377613', '377686', '377735', '377736', '390341', '390347']
    nosy_count = 4.0
    nosy_names = ['vstinner', 'Mark.Shannon', 'corona10', 'pablogsal']
    pr_nums = ['22427', '22462', '25219']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'performance'
    url = 'https://bugs.python.org/issue41870'
    versions = ['Python 3.10']

    @corona10
    Copy link
    Member Author

    bool type is well-used builtin types, I noticed that if we use vector call to bool type, it shows the awesome performance enhancement.

    Mean +- std dev: [master] 91.4 us +- 3.3 us -> [vectorcall] 48.6 us +- 3.1 us: 1.88x faster (-47%)

    @corona10 corona10 added the 3.10 only security fixes label Sep 27, 2020
    @corona10 corona10 self-assigned this Sep 27, 2020
    @corona10 corona10 added performance Performance or resource usage 3.10 only security fixes labels Sep 27, 2020
    @corona10 corona10 self-assigned this Sep 27, 2020
    @corona10 corona10 added performance Performance or resource usage interpreter-core (Objects, Python, Grammar, and Parser dirs) labels Sep 27, 2020
    @corona10
    Copy link
    Member Author

    New changeset a195bce by Dong-hee Na in branch 'master':
    bpo-41870: Use PEP-590 vectorcall to speed up bool() (GH-22427)
    a195bce

    @corona10
    Copy link
    Member Author

    Now I close this issue.
    Thank you, Mark!

    @vstinner
    Copy link
    Member

    You can put ok<0 test in the if (nargs) branch, to avoid the test when nargs=0.

    @pablogsal
    Copy link
    Member

    You can put ok<0 test in the if (nargs) branch, to avoid the test when nargs=0.

    +1

    @corona10
    Copy link
    Member Author

    corona10 commented Oct 1, 2020

    New changeset fa7ce08 by Dong-hee Na in branch 'master':
    bpo-41870: Avoid the test when nargs=0 (GH-22462)
    fa7ce08

    @corona10
    Copy link
    Member Author

    corona10 commented Oct 1, 2020

    Now the suggestion is applied!
    Thank you Pablo and Victor!!!

    @corona10
    Copy link
    Member Author

    corona10 commented Apr 6, 2021

    For the record, following built-in functions now support vectorcall calling convention from Python 3.10!!

    Thank you to everyone who works with this :)

    @corona10
    Copy link
    Member Author

    corona10 commented Apr 6, 2021

    New changeset efccff9 by Dong-hee Na in branch 'master':
    bpo-41870: Update What's News 3.10 about vectorcall (bpo-25219)
    efccff9

    @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

    3 participants