Skip to content

Use Python built-in str.lower in preference to asciiUpper2Lower character table translation #526

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 2 commits into from
Closed

Use Python built-in str.lower in preference to asciiUpper2Lower character table translation #526

wants to merge 2 commits into from

Conversation

jayaddison
Copy link
Contributor

This change uses Python's builtin str.lower to perform string lowercasing (typically used during case-insensitive element/attribute name comparison), and provides a nice small parsing performance benefit on Python (cpython 3.9.1).

Benchmark command used: python benchmarks/bench_html.py parse --rigorous

Before

.........................................
html_parse_etree: Mean +- std dev: 208 ms +- 14 ms

After

.........................................
html_parse_etree: Mean +- std dev: 200 ms +- 12 ms

This follows on from some conversation in #520 regarding comparison operations and lowercasing.

@jayaddison
Copy link
Contributor Author

Cleaning up some old / stale pull requests; please let me know if this changeset is considered worthwhile and I'll reopen if so.

@jayaddison jayaddison closed this Dec 24, 2022
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