Skip to content
This repository was archived by the owner on Nov 9, 2025. It is now read-only.

Optimise to_ascii_lowercase_smolstr, to_ascii_uppercase_smolstr#97

Merged
Veykril merged 2 commits intorust-analyzer:masterfrom
alexheretic:faster-ascii-case
Sep 22, 2025
Merged

Optimise to_ascii_lowercase_smolstr, to_ascii_uppercase_smolstr#97
Veykril merged 2 commits intorust-analyzer:masterfrom
alexheretic:faster-ascii-case

Conversation

@alexheretic
Copy link
Copy Markdown
Contributor

@alexheretic alexheretic commented Sep 13, 2025

Optimisation opportunity highlighted by testing against String perf and using benchmarks in #96.

PR bench

group                                  master                  faster-ascii-case
-----                                  ------                  -----------------
to_ascii_lowercase_smolstr len=12      2.06     13.5±0.01ns    1.00      6.6±0.01ns
to_ascii_lowercase_smolstr len=50      4.31    110.3±0.19ns    1.00     25.6±0.07ns
to_ascii_lowercase_smolstr len=1000    22.17  1396.8±2.63ns    1.00     63.0±0.01ns

The change provides a significant perf improvement on inline & heap reprs. Also faster than String for len=12 now 🙂

Copy link
Copy Markdown
Member

@Veykril Veykril left a comment

Choose a reason for hiding this comment

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

Thanks!

@Veykril Veykril merged commit b3ac1b5 into rust-analyzer:master Sep 22, 2025
1 check passed
@alexheretic alexheretic deleted the faster-ascii-case branch October 22, 2025 13:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants