Skip to content

perf: use lazy-initialized regexes instead of per-call compilation#3071

Merged
messense merged 1 commit into
PyO3:mainfrom
messense:regex-perf
Mar 9, 2026
Merged

perf: use lazy-initialized regexes instead of per-call compilation#3071
messense merged 1 commit into
PyO3:mainfrom
messense:regex-perf

Conversation

@messense

@messense messense commented Mar 9, 2026

Copy link
Copy Markdown
Member

Convert all Regex::new() calls that were compiled on every function invocation to use once_cell::sync::Lazy statics.

Convert all Regex::new() calls that were compiled on every function
invocation to use once_cell::sync::Lazy statics:

- develop/mod.rs: parse_direct_url_path() - 2 regexes
- develop/install_backend.rs: version() - pip/uv version regexes
- metadata.rs: get_distribution_escaped()
- upload.rs: canonicalize_name() and upload_ui() title regex
- new_project.rs: pypi_check_name()
- auditwheel/musllinux.rs: get_musl_version()
- python_interpreter/discovery.rs: Windows py launcher and conda parsers
- target/platform_tag.rs: Android API level detection
@messense messense merged commit 552e68a into PyO3:main Mar 9, 2026
43 of 44 checks passed
@messense messense deleted the regex-perf branch March 9, 2026 00:27
bmwiedemann pushed a commit to bmwiedemann/openSUSE that referenced this pull request Apr 14, 2026
https://build.opensuse.org/request/show/1346282
by user mia + dimstar_suse
- Update to version 1.13.1
  * fix: fall back to placeholder for abi3 when found interpreters
    are too old
    gh#PyO3/maturin#3126
- Changes in version 1.13.0:
  * Sync legacy_py.rs with upstream PyPI warehouse legacy.py
    gh#PyO3/maturin#3053
  * Fix --strip conflicting with --include-debuginfo in develop
    gh#PyO3/maturin#3057
  * Fix abi3 wheel producing version-specific tags for CPython
    below minimum
    gh#PyO3/maturin#3061
  * Fix data symlink permission handling
    gh#PyO3/maturin#3069
  * fix: correct bugs in audit.rs typo and module_writer
    gh#PyO3/maturin#3070
  * perf: use lazy-initialized regexes instead of per-call
    compilation
    gh#PyO3/maturin#3071
  * fix: skip legacy manylinux aliases not in PyPI allow-list
    gh#PyO3/maturin#3078
  * fix: auto-generat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant