> De: "John Rose" <john.r.r...@oracle.com>
> À: "Da Vinci Machine Project" <mlvm-dev@openjdk.java.net>
> Envoyé: Jeudi 15 Septembre 2016 21:02:14
> Objet: Re: A fast JSON serializer

> On Sep 14, 2016, at 3:03 PM, Remi Forax < fo...@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

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

doing the update the of inlining cache at the end is not that difficult 
BTW, a student of mine will do an update of the JSR 292 cookbook as his master 
thesis later this year. the hope to clean the dirt and add new patterns. 

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

i've thunk a little about that, the idea was that the user has to declare that 
the string need escaping using a field of the annotation JSONProperty. 

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

doh, sorry, i botch that, i've updated the code with a version that should work 
:) 

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

with the restriction that you can not have more than 255 holes in the template 
:) 

> — John

Rémi 

> _______________________________________________
> mlvm-dev mailing list
> mlvm-dev@openjdk.java.net
> http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev
_______________________________________________
mlvm-dev mailing list
mlvm-dev@openjdk.java.net
http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev

Reply via email to