Skip to content

Performance optimization for case_fold, second edition - #335

Merged
tzlaine merged 1 commit into
boostorg:developfrom
andreasbuhr:case_fold_fast_path_2
Oct 24, 2026
Merged

tzlaine merged 1 commit into
boostorg:developfrom
andreasbuhr:case_fold_fast_path_2

Conversation

@andreasbuhr

Copy link
Copy Markdown
Contributor

Reading my last comment in #326 I nerded out a bit and created this.

There was one call to std::lower_bound for each space, for each parenthesis, for each newline, and for each bracket. This is not required.
See https://www.unicode.org/Public/UCD/latest/ucd/CaseFolding.txt and https://www.fileformat.info/info/charset/UTF-32/list.htm

Now we only have one comparison with 0x41 for each punctuation character, two comparisons for each uppercase ASCII letter and three comparisons for each lowercase ASCII letter.

There was one call to std::lower_bound for each space,
for each parenthesis, for each newline, and for each bracket.
This is not required.
See https://www.unicode.org/Public/UCD/latest/ucd/CaseFolding.txt
and https://www.fileformat.info/info/charset/UTF-32/list.htm
@tzlaine

tzlaine commented Oct 24, 2026

Copy link
Copy Markdown
Collaborator

Thanks!

@tzlaine
tzlaine merged commit 550f6be into boostorg:develop Oct 24, 2026
27 of 28 checks passed
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.

2 participants