Skip to content

Commit 942cd3f

Browse files
authored
Merge pull request #662 from casperisfine/refactor-generate-nl
Elide Generator::State allocation until a to_json method has to be called
2 parents 87e4ab9 + 5009e78 commit 942cd3f

File tree

8 files changed

+251
-150
lines changed

8 files changed

+251
-150
lines changed

benchmark/encoder.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ def benchmark_encoding(benchmark_name, ruby_obj, check_expected: true, except: [
6060
# The performance difference is mostly more time spent in GC because of this extra pressure.
6161
# If we re-use the same `JSON::State` instance, we're faster than Oj on the array benchmark, and much closer
6262
# on the Hash one.
63+
benchmark_encoding "small mixed", [1, "string", { a: 1, b: 2 }, [3, 4, 5]]
6364
benchmark_encoding "small nested array", [[1,2,3,4,5]]*10
6465
benchmark_encoding "small hash", { "username" => "jhawthorn", "id" => 123, "event" => "wrote json serializer" }
6566

0 commit comments

Comments
 (0)