Commit 947902e
committed
parser.c: Optimize
We can use `ctz` builtin to get the number of consecutive digits.
```
== Parsing float parsing (2251051 bytes)
ruby 3.4.6 (2025-09-16 revision dbd83256b1) +YJIT +PRISM [arm64-darwin24]
Warming up --------------------------------------
after 25.000 i/100ms
Calculating -------------------------------------
after 231.963 (± 0.0%) i/s (4.31 ms/i) - 1.175k in 5.065467s
Comparison:
before: 215.3 i/s
after: 232.0 i/s - 1.08x faster
```json_parse_digits
1 parent ded62a5 commit 947902e
1 file changed
+10
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1101 | 1101 | | |
1102 | 1102 | | |
1103 | 1103 | | |
1104 | | - | |
| 1104 | + | |
| 1105 | + | |
1105 | 1106 | | |
1106 | 1107 | | |
1107 | | - | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
1108 | 1115 | | |
1109 | 1116 | | |
1110 | | - | |
| 1117 | + | |
1111 | 1118 | | |
1112 | 1119 | | |
1113 | 1120 | | |
| |||
0 commit comments