Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: JRuby 1.6.3
-
Fix Version/s: JRuby 1.7.0.pre1
-
Component/s: Performance
-
Labels:None
-
Environment:OSX, json gem version 1.6.1
-
Number of attachments :
Description
MRI with the json gem (plus C extension) is about 2x faster than JRuby for encoding and 2.5x faster for decoding. I believe the JRuby json gem has a native java extension, so performance should be comparable.
The gist contains the benchmark code and the output for both MRI & JRuby.
I pushed a fix for Fixnum#to_s logic, avoiding the pass through a Java String, which brings the fast_generate part almost up to 1.9.3 speed. The remaining overhead is probably in json itself.
https://github.com/jruby/jruby/commit/3efcf88b5e50bf86c816a2e6488480968b6210e9
The parse benchmark, as I'd expect, is also slow because of passing through Java String logic. Specifically, we use Long.valueOf() to do our parsing, and then convert that into ISO-8859-1 characters. That will be a more complicated fix.