A fast JSON serializer

John Rose john.r.rose at oracle.com
Thu Sep 15 19:02:14 UTC 2016


On Sep 14, 2016, at 3:03 PM, Remi Forax <forax at univ-mlv.fr> wrote:
> 
> Another idea from the JVM Summit,
> because the JDK9 now uses fast string concatenation by default, a JSON serializer based on reflection can be outperformed by a hand written code.  
> 
> The following code is a small JSON serializer that use the StringConcatFactory of JDK9
>  https://gist.github.com/forax/76124b69631475105f87ddd2205a4d91 <https://gist.github.com/forax/76124b69631475105f87ddd2205a4d91>
> 

Very cute.  Lots of ideas in there.  Cool use of permuteArgs.  And a MIC!

Doesn't handle strings with quotes or escapes, but that's easy to fix if you don't care about performance of that case.

Re-entrance detection is too strict, I think; looks like it would fail if the Car had a Wheel.

You could build a templating engine by factoring out the middle parts of it.  That could then be used to create the JSON dumper.

— John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/mlvm-dev/attachments/20160915/22bb9037/attachment-0001.html>


More information about the mlvm-dev mailing list