Thursday, May 1, 2014

Boon JSON parser 1.7 MB JSON String against all competitors

Boon does not come with just one JSON parser. Boon comes with many, and now so does Groovy.

There is the Boon JSON classic parser which does not use index overlay.

Let's see how Boon and Groovy stack up to the competitors.

This time I am going to throw in a few more of the Boon JSON parsers.

This is parsing a 1.7 MB JSON string. Why didn't I cover each type of parser in the last benchmark.... 

Because it is boring. I just picked the best one for the benchmark.

But there are parsers that are geared toward certain use cases. 

Operations per second.

Benchmark                                           Mode   Thr     Count  Sec    Mean        Mean error    
StatelessBoonBenchMark.citmCatalog                  thrpt  16         6        1466.217      155.257  
OverlayBoonBenchmark.citmCatalog                    thrpt  16         6    1     1418.458      108.627   
NewJsonGroovySlurper.citmCatalog                    thrpt  16         6    1     1412.053       55.958   
BoonClassicBenchmark.citmCatalog                    thrpt  16         6    1     1192.436       24.942    
BoonReaderLargeStreamBenchMark.citmCatalog          thrpt  16         6    1      902.431       58.533    
CharSourceBoonJSONParser.citmCatalog                thrpt  16         6    1      901.042       53.123    
GSONBenchmark.citmCatalog                           thrpt  16         6    1      584.594       58.404   
JsonSmartBenchmark.citmCatalog                      thrpt  16         6    1      514.056       52.994    
JacksonASTBenchmark.citmCatalog                     thrpt  16         6    1      407.500       24.809   
JacksonObjectBenchmark.citmCatalog                  thrpt  16         6    1      436.992       35.787    
JsonSimpleBenchmark.citmCatalog                     thrpt  16         6    1      221.181       21.557   
OldJsonGroovySlurper.citmCatalog                    thrpt  16         6    1       66.803       21.247   

So the 1192 parser is not an overlay parser. Also there is actually another config option that is midway between an overlay and a non overlay called a full chop, but I wont go there, it would score about a 1300 or so.  

Now Boon and Groovy JSON parsing currently share the same DNA more or less so what I say for Boon more or less applies to Groovy.

1st: Boon 1st place index overlay no shared buffers
2nd: Boon second place index overlay using shared buffers
3rd: NewJsonGroovySlurper using index overlay
4th: Boon Class with no Index Overlay. Notice Boon with NO INDEX OVERLAY IS STILL AHEAD OF THE REST.
5th: Boon big stream parser using a character source abstraction
6th: Boon similar to 5, but sort of hard to explain the difference without a full article
7th: GSON
9th: Jackson AST 
10th Jackson Object mapper
11th JsonSimple
12th the Old groovy before the optimization.

Why didn't I include all of the boon JSON parsers, well because no one cares. There is also an Ascii BOON parser and a direct from UTF-8 parser. 

BOON despite recent FUD does quite well with inputstream (and by quite well, I mean it is faster than the rest). It also does quite well with reader, byte[], etc. 

There are limitations for Boon. But index overlay is not really cheating. In fact, it makes a lot of sense for POJO serialization and deserialization and for things like JSON path, and for working with maps when there is a good possibility that not all key/values will be accessed. 

Also if you don't like index overlay, you don't have to use it and Boon is still between 3.5 and 4x faster than Jackson. 

(I actually thought Jackson was faster than GSON and JSONSmart on this one. I know it is faster than them an inputstream, etc.)

Index overlay, at least with Boon, is about a 20 to 30% gain. 

I have hundreds of benchmarks if someone really wants me to run them all and create graphs again. I'd rather do other stuff. :)

No comments:

Post a Comment

Kafka and Cassandra support, training for AWS EC2 Cassandra 3.0 Training