Skip to content

Improve speed of test_tokenize.StringPrefixTest.test_prefixes #134752

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

Open
ericvsmith opened this issue May 26, 2025 · 0 comments
Open

Improve speed of test_tokenize.StringPrefixTest.test_prefixes #134752

ericvsmith opened this issue May 26, 2025 · 0 comments
Assignees
Labels
3.14 bugs and security fixes 3.15 new features, bugs and security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@ericvsmith
Copy link
Member

ericvsmith commented May 26, 2025

Bug report

Bug description:

It takes about 0.5 seconds to run, because it's doing 127,452 eval statements. It could no doubt be sped up, although I might have to sacrifice some completeness. For example, one simplifying assumption is that all multi-character string prefixes must begin with one of the single-character prefix. I guess it's possible that this won't always be the case, but it seems likely to continue.

CPython versions tested on:

3.15

Operating systems tested on:

Windows

Linked PRs

@ericvsmith ericvsmith added type-bug An unexpected behavior, bug, or error needs backport to 3.14 bugs and security fixes skip news stdlib Python modules in the Lib dir labels May 26, 2025
@ericvsmith ericvsmith self-assigned this May 26, 2025
miss-islington pushed a commit to miss-islington/cpython that referenced this issue May 27, 2025
…_prefixes. (pythonGH-134766)

(cherry picked from commit 579686d)

Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
@picnixz picnixz added 3.14 bugs and security fixes 3.15 new features, bugs and security fixes and removed skip news needs backport to 3.14 bugs and security fixes labels May 27, 2025
ericvsmith added a commit that referenced this issue May 27, 2025
…t_prefixes. (GH-134766) (#134782)

gh-134752: Improve speed of test_tokenize.StringPrefixTest.test_prefixes. (GH-134766)
(cherry picked from commit 579686d)

Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.14 bugs and security fixes 3.15 new features, bugs and security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants