Skip to content

bpo-23689: re module, fix memory leak when a match is terminated by a signal or memory allocation failure #32223

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

Closed
wants to merge 8 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Apr 1, 2022

@serhiy-storchaka , please review the commits one by one.

MSVC 2022 non-PGO release build, run test_re.py. It's a bit slower.

(best of 10)
Before: 0.278 sec
After:  0.283 sec

But when switching REPEAT very frequently, it has some speed up:

import pyperf

setup = ("import re;"
         "s = 100_000_000 * 'a';"
         "p = r'.*?(?:bb)+';"
         "p = re.compile(p)")
stmt = "p.match(s)"

runner = pyperf.Runner()
runner.timeit("match", stmt=stmt, setup=setup)

# Before: Mean +- std dev: 1.88 sec +- 0.03 sec
# After:  Mean +- std dev: 1.63 sec +- 0.03 sec

https://bugs.python.org/issue23689

@serhiy-storchaka
Copy link
Member

My internet connection is very bad last days, so it will take a time for review, sorry.

@ghost
Copy link
Author

ghost commented Apr 1, 2022

It doesn't matter.

@ghost ghost closed this Apr 3, 2022
@ghost ghost deleted the repeat_array branch April 4, 2022 06:11
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants