-
Notifications
You must be signed in to change notification settings - Fork 353
Closed as not planned
Description
We've recently removed Oj from our production app and started using JSON. We are now noticing degraded performance in cases where we need we call to_json
on very large objects. Here's a benchmark comparing serializing the attached file with JSON and Oj.
print "Testing JSON...\n"
obj = JSON.parse(File.read("large_example.json"))
objs = [obj] * 10
Benchmark.bm do |x|
x.report { objs.to_json }
end
Output:
user system total real
1.046600 0.061810 1.108410 ( 1.107597)
print "Testing OJ...\n"
Oj.optimize_rails
obj = JSON.parse(File.read("large_example.json"))
objs = [obj] * 10
Benchmark.bm do |x|
x.report { objs.to_json }
end
Output:
user system total real
0.103054 0.006695 0.109749 ( 0.109749)
Metadata
Metadata
Assignees
Labels
No labels