Skip to content

Faster bypass re cache when DEBUG is passed #66700

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
serhiy-storchaka opened this issue Sep 28, 2014 · 3 comments
Closed

Faster bypass re cache when DEBUG is passed #66700

serhiy-storchaka opened this issue Sep 28, 2014 · 3 comments
Labels
stdlib Python modules in the Lib dir topic-regex type-feature A feature request or enhancement

Comments

@serhiy-storchaka
Copy link
Member

BPO 22510
Nosy @pitrou, @ezio-melotti, @serhiy-storchaka
Files
  • re_debug_cache_faster.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 = None
    closed_at = <Date 2014-09-29.17:02:10.439>
    created_at = <Date 2014-09-28.13:43:11.638>
    labels = ['expert-regex', 'type-feature', 'library']
    title = 'Faster bypass re cache when DEBUG is passed'
    updated_at = <Date 2014-09-29.17:02:10.438>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2014-09-29.17:02:10.438>
    actor = 'serhiy.storchaka'
    assignee = 'none'
    closed = True
    closed_date = <Date 2014-09-29.17:02:10.439>
    closer = 'serhiy.storchaka'
    components = ['Library (Lib)', 'Regular Expressions']
    creation = <Date 2014-09-28.13:43:11.638>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = ['36749']
    hgrepos = []
    issue_num = 22510
    keywords = ['patch']
    message_count = 3.0
    messages = ['227758', '227801', '227810']
    nosy_count = 5.0
    nosy_names = ['pitrou', 'ezio.melotti', 'mrabarnett', 'python-dev', 'serhiy.storchaka']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue22510'
    versions = ['Python 3.5']

    @serhiy-storchaka
    Copy link
    Member Author

    Here is a patch which gets rid of small performance regression introduced by bpo-20426 patch. No need to check flags before cache lookup because patterns with the DEBUG flag are newer cached.

    $ ./python -m timeit -s "import re" -- "re.match('', '')"

    Before patch: 9.08 usec per loop
    After patch: 8 usec per loop

    @serhiy-storchaka serhiy-storchaka added stdlib Python modules in the Lib dir topic-regex type-feature A feature request or enhancement labels Sep 28, 2014
    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Sep 29, 2014

    New changeset 565096a32ce4 by Serhiy Storchaka in branch 'default':
    Issue bpo-22510: Get rid of little overhead of testing re.DEBUG flag.
    https://hg.python.org/cpython/rev/565096a32ce4

    @serhiy-storchaka
    Copy link
    Member Author

    Thank you Antoine for your review.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    # for free to join this conversation on GitHub. Already have an account? # to comment
    Labels
    stdlib Python modules in the Lib dir topic-regex type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant