[ruby/json] Reduce comparisons when parsing numbers

Before this commit, we would try to scan for a float, then if that
failed, scan for an integer.  But floats and integers have many bytes in
common, so we would end up scanning the same bytes multiple times.

This patch combines integer and float scanning machines so that we only
have to scan bytes once.  If the machine finds "float parts", then it
executes the "isFloat" transition in the machine, which sets a boolean
letting us know that the parser found a float.

If we didn't find a float, but we did match, then we know it's an int.

0c0e0930cd
This commit is contained in:
Aaron Patterson 2024-11-06 17:12:07 -08:00 committed by Hiroshi SHIBATA
parent f1be046a1d
commit c991f75c19
2 changed files with 195 additions and 268 deletions

File diff suppressed because it is too large Load diff