summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAaron Patterson <tenderlove@ruby-lang.org>2024-11-06 17:12:07 -0800
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2024-11-11 09:40:10 +0900
commitc991f75c19d787ba461037304c78c1ed6ca7c837 (patch)
treee41023e198893a15c43d6695a8efbeda00d2be44 /include
parentf1be046a1d0a4d6acaec4580d5c885e3b81468af (diff)
[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. https://github.com/ruby/json/commit/0c0e0930cd
Diffstat (limited to 'include')
0 files changed, 0 insertions, 0 deletions