Skip to content

Commit 11a5d9a

Browse files
Andreas Buhrtzlaine
authored andcommitted
Add fast-path for lower case ASCII letters in case_fold
This improved the speed of my parser by approximately 20%
1 parent d241bd7 commit 11a5d9a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

include/boost/parser/detail/case_fold.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,10 @@ namespace boost::parser::detail {
4747
// One-byte fast path.
4848
if (cp < 0x100) {
4949
// ASCII letter fast path.
50-
if (0x41 <= cp && cp < 0x5a) {
50+
if (0x61 <= cp && cp < 0x7a) {
51+
*out++ = cp;
52+
return out;
53+
} else if (0x41 <= cp && cp < 0x5a) {
5154
*out++ = cp + 0x20;
5255
return out;
5356
} else if (cp == 0x00DF) {

0 commit comments

Comments
 (0)