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

Pre-compile nearly all regex patterns #82

Merged
merged 6 commits into from
Oct 12, 2023

Conversation

AlexWaygood
Copy link
Collaborator

None of these changes makes a signficant difference by itself. But taken together, I measure around a 9% speedup over main currently! Part of #76

@AlexWaygood AlexWaygood marked this pull request as draft October 12, 2023 08:48
@AlexWaygood AlexWaygood marked this pull request as ready for review October 12, 2023 09:05
@@ -64,7 +64,7 @@ def test_sphinxlint_shall_not_pass(file, expected_errors, capsys):
assert expected_error in out
number_of_expected_errors = len(expected_errors)
number_of_reported_errors = len(out.splitlines())
assert number_of_expected_errors == number_of_reported_errors
assert number_of_expected_errors == number_of_reported_errors, f"{number_of_reported_errors=}, {out=}"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not an optimisation, but I found this quite helpful for debugging test failures on my first commit in this PR! Happy to take this out if you prefer, though; I accidentally committed it here 😆

sphinxlint/rst.py Outdated Show resolved Hide resolved
@AlexWaygood
Copy link
Collaborator Author

Thanks for the review @ezio-melotti! Just pushed a couple more changes, if you want to take another quick look over :)

Copy link
Collaborator

@hugovk hugovk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On macOS, time sphinx-lint Doc on CPython on main is 1.819s, with this PR 1.567s, 14% faster.

sphinxlint/checkers.py Outdated Show resolved Hide resolved
sphinxlint/checkers.py Outdated Show resolved Hide resolved
Co-authored-by: Hugo van Kemenade <[email protected]>
@hugovk hugovk merged commit 3e99049 into sphinx-contrib:main Oct 12, 2023
15 checks passed
@AlexWaygood AlexWaygood deleted the more-regex-compilations branch October 12, 2023 15:39
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.

3 participants