2
0
mirror of https://github.com/boostorg/parser.git synced 2026-01-19 04:22:13 +00:00

Add fast-path for lower case ASCII letters in case_fold

This improved the speed of my parser by approximately 20%
This commit is contained in:
Andreas Buhr
2025-08-02 14:10:05 +02:00
committed by Zach Laine
parent d241bd7853
commit 11a5d9a872

View File

@@ -47,7 +47,10 @@ namespace boost::parser::detail {
// One-byte fast path.
if (cp < 0x100) {
// ASCII letter fast path.
if (0x41 <= cp && cp < 0x5a) {
if (0x61 <= cp && cp < 0x7a) {
*out++ = cp;
return out;
} else if (0x41 <= cp && cp < 0x5a) {
*out++ = cp + 0x20;
return out;
} else if (cp == 0x00DF) {