It is necessary to run code to be tested for couple of seconds first on new JVM, before taking measurements; otherwise test is about how fast JVM can load (and possibly inline) bytecode.
Using the jvm-serializers (https://github.com/eishay/jvm-serializers/wiki) test suite, I get significantly different results. When testing with about 736 bytes of JSON input (in java.lang.String format), my results show the different APIs performing in the following order, ranked from fastest to slowest.
ser deser total
json/jackson-databind-strings 6034808514209
json/fastjson-databind 5837892414826
json/json-smart/manual/tree 13104964423182
json/org.json/manual/tree 164042003936526
json/json.simple/manual/tree 159712195438170
json/jsonij-manual/tree 751241688892275
json/argo-manual/tree-builders 17656651439228847
json/json-lib-databind 73202169966243474
Using the json-smart performance as the baseline, here are the same numbers as percentages (rounded to the nearest whole number).
ser deser total
json/jackson-databind-strings 46%84%61%
json/fastjson-databind 45%93%64%
json/json-smart/manual/tree 100%100%100%
json/org.json/manual/tree 125%208%158%
json/json.simple/manual/tree 122%228%165%
json/jsonij-manual/tree 573%175%398%
json/argo-manual/tree-builders 1347%533%987%
json/json-lib-databind 559%1762%1050%
These results place the performance of some of the different APIs in significantly different orders, and some with significantly different percentages.
As time permits, I'll try to figure out what the cause of the different results is.
(I have no affiliation with any of these projects, or with any other JSON processing project.)
大家都知道JSON是一个与平台无关的一种数据格式,所以它也得到来广大编程者的认可,在目前各种JSON格式的第三方LIB都层出不穷,如雨后春生一样,面对这些,我们到底取怎么选择呢,首先,我们来比对一下目前其相关的JSON解析库的性能:Json BecnhMarkBench ProtoleThose test are generate by parr
Where is the source? Are you warming up GC (if not, this test is totally meaningless)? What kind of JSON are you parsing?
Sources are available now: http://json-smart.googlecode.com/svn/trunk/bench/
Json test string generator: http://json-smart.googlecode.com/svn/trunk/bench/src/net/minidev/bench/json/TestData.java
a new JVM is started for each test, GC is never explicitely called.
Whops, meant JVM warmed up, not GC. :-)
It is necessary to run code to be tested for couple of seconds first on new JVM, before taking measurements; otherwise test is about how fast JVM can load (and possibly inline) bytecode.
Warmed up test is now available.
Using the jvm-serializers (https://github.com/eishay/jvm-serializers/wiki) test suite, I get significantly different results. When testing with about 736 bytes of JSON input (in java.lang.String format), my results show the different APIs performing in the following order, ranked from fastest to slowest.
Using the json-smart performance as the baseline, here are the same numbers as percentages (rounded to the nearest whole number).
These results place the performance of some of the different APIs in significantly different orders, and some with significantly different percentages.
As time permits, I'll try to figure out what the cause of the different results is.
(I have no affiliation with any of these projects, or with any other JSON processing project.)