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

re module microoptimization: speed up bytes \w \s \d matching #78817

Closed
gpshead opened this issue Sep 11, 2018 · 3 comments
Closed

re module microoptimization: speed up bytes \w \s \d matching #78817

gpshead opened this issue Sep 11, 2018 · 3 comments
Assignees
Labels
3.8 (EOL) end of life performance Performance or resource usage

Comments

@gpshead
Copy link
Member

gpshead commented Sep 11, 2018

BPO 34636
Nosy @gpshead, @miss-islington
PRs
  • bpo-34636: Use fast path for more chars in SRE category macros. #9170
  • 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/gpshead'
    closed_at = <Date 2018-09-12.00:14:20.241>
    created_at = <Date 2018-09-11.22:00:58.089>
    labels = ['3.8', 'performance']
    title = 're module microoptimization: speed up bytes \\w \\s \\d matching'
    updated_at = <Date 2018-09-12.00:14:20.240>
    user = 'https://github.com/gpshead'

    bugs.python.org fields:

    activity = <Date 2018-09-12.00:14:20.240>
    actor = 'gregory.p.smith'
    assignee = 'gregory.p.smith'
    closed = True
    closed_date = <Date 2018-09-12.00:14:20.241>
    closer = 'gregory.p.smith'
    components = []
    creation = <Date 2018-09-11.22:00:58.089>
    creator = 'gregory.p.smith'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 34636
    keywords = []
    message_count = 3.0
    messages = ['325073', '325074', '325086']
    nosy_count = 2.0
    nosy_names = ['gregory.p.smith', 'miss-islington']
    pr_nums = ['9170']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'commit review'
    status = 'closed'
    superseder = None
    type = 'performance'
    url = 'https://bugs.python.org/issue34636'
    versions = ['Python 3.8']

    @gpshead
    Copy link
    Member Author

    gpshead commented Sep 11, 2018

    filing this issue to track #9170

    @gpshead gpshead added the 3.8 (EOL) end of life label Sep 11, 2018
    @gpshead gpshead self-assigned this Sep 11, 2018
    @gpshead gpshead added the performance Performance or resource usage label Sep 11, 2018
    @gpshead
    Copy link
    Member Author

    gpshead commented Sep 11, 2018

    Confirming the microoptimization here with a non-debug (opt) build:

    ~/oss/cpython$ sre-before/python -m timeit -s "import re; s = (b'~' * 1000000); f = re.compile(b'\s\w\d').search" "f(s)"
    20 loops, best of 5: 11 msec per loop
    ~/oss/cpython$ sre-after/python -m timeit -s "import re; s = (b'~' * 1000000); f = re.compile(b'\s\w\d').search" "f(s)"
    20 loops, best of 5: 10.1 msec per loop

    Those results are consistent across reruns.

    @miss-islington
    Copy link
    Contributor

    New changeset ec014a1 by Miss Islington (bot) (Sergey Fedoseev) in branch 'master':
    bpo-34636: Use fast path for more chars in SRE category macros. (GH-9170)
    ec014a1

    @gpshead gpshead closed this as completed Sep 12, 2018
    @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.8 (EOL) end of life performance Performance or resource usage
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants