Re: [json] Performance of JSON libraries
- On Thu, Feb 19, 2009 at 11:08 PM, Fang Yidong <fangyidong@...> wrote:
> Hello Tatu,Hi there! Yes, that is true.
> While I was googling JSON.simple usage, I occasionally find JsonSimpleDriver.java in svn of codehaus, and the benchmark results, comparing with Jackson and other libraries. I think that it's your work?
>Sure, thank you for your input. I hadn't yet published it, but it is
> The throughput of Jackson is high definitely and I really think Jackson is an excellent StAX JSON parser.
> I am writing to you because I'd like to share some of my opinions on the testing itself. I know that you haven't pulished the results yet, here's just some discussions.
of course public from the blog.
>Hmmh. I don't think I fully agree, but I agree in that it depends on use case.
> Here's my opinions:
> 1. I think different libraries accept different inputs, such as a byte array, a string, a inputstream or a reader, so the preparation of such input objects should be prepared in the warm up stage, not the running.
For me, the use case is always getting Json from an external source
(network request, from file system), and hence input is naturally a
stream of bytes. So if a library just takes a String, it must be
constructed from bytes.
I did give shortcuts for some parsers so that there was no need to
read from the stream, so in a way some parsers benefited from the
setup (from my perspective).
It is possible that other use cases could be ones where a String would
be needed anyway (like perhaps reading it from a DB), but for me this
is not the case.
> 2. I think the iteration of the resulting graph is not a part of the parser and should not be put in the run method, but some minor operations can be performed to verified that the result is a correct one.I think needs to be, because otherwise you can not do anything of use;
and parsers could optimize away some processing.
I don't think results would differ a lot though, most parsers do
handle all the data independent of traversal. I can probably make this
configurable to see what the difference is.
> 3. Could you also help to test the SAX-like interface of JSON.simple in the way of JacksonDriverStreaming.java did?Ah yes. Apologies for not trying it out -- I forgot that json.simple
does in fact have a streaming interface. I can add that, and make it
the main interface.
> I think your work will definitely help to improve the qualities of all JSON libraries.Thank you, and thanks for feedback!
-+ Tatu +-
- On Thu, Feb 19, 2009 at 11:14 PM, Fang Yidong <fangyidong@...> wrote:
> Sorry this message is intended to send to Tatu only. My bad.(took the discussion offline, but if anyone is interested in what
> Since the result is not published yet, let's discuss it privately.
results we are discussing, those are at:
I will be making some updates; and if any owners of other packages
have suggestions, let me know as well. Benchmarks are hard to do well
with different use cases and emphasis, so at least I want to document
presumptions and biases.
-+ Tatu +-