Finalize Kevin's handrolled parser.

And get rid of the Ragel parser.

This is 7% faster on activitypub, 15% after on twitter and 11% faster
on citm_catalog.

There might be some more optimization opportunities, I did a quick
optimization pass to fix a regression in string parsing, but other
than that I haven't dug much in performance.
This commit is contained in:
Jean Boussier 2025-01-15 12:54:25 +01:00 committed by Hiroshi SHIBATA
parent 1c8fc25b88
commit ef585744c0
Notes: git 2025-01-20 07:09:23 +00:00
3 changed files with 588 additions and 3642 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -104,6 +104,11 @@ class JSONParserTest < Test::Unit::TestCase
assert_raise(JSON::ParserError) { parse('+23') }
assert_raise(JSON::ParserError) { parse('.23') }
assert_raise(JSON::ParserError) { parse('023') }
assert_raise(JSON::ParserError) { parse('-023') }
assert_raise(JSON::ParserError) { parse('023.12') }
assert_raise(JSON::ParserError) { parse('-023.12') }
assert_raise(JSON::ParserError) { parse('023e12') }
assert_raise(JSON::ParserError) { parse('-023e12') }
assert_equal(23, parse('23'))
assert_equal(-23, parse('-23'))
assert_equal_float(3.141, parse('3.141'))
@ -620,7 +625,7 @@ class JSONParserTest < Test::Unit::TestCase
JSON.parse('{"input":{"firstName":"Bob","lastName":"Mob","email":"bob@example.com"}')
end
if RUBY_ENGINE == "ruby"
assert_equal %(unexpected token at '{"input":{"firstName":"Bob","las'), error.message
assert_equal %(expected ',' or '}' after object value, got: ''), error.message
end
end