This looks cool, but I'm also interested in seeing if compared to GSON not just Jackson. Is the `JsonField` annotation mandatory? In most cases my variable names are the same as the field names in the JSON, which is why I love using GSON since it auto-picks up on that.
It looks kind of odd in your sample code too, it'd be nice if it could auto-try those fields, but I can see why that won't work if this is compile-time rather than at processing-time like GSON (it has no way of checking against the JSON to see if that assumption is true) -- maybe have `JsonType` take and optional parameter that enables "guess types" mode?
I'm one of the authors of this library. The code this library emits is very similar to the json/jackson/manual serializer/deserializer in https://github.com/eishay/jvm-serializers/wiki. Conveniently, GSON is benchmarked there too.
You're right, the field names could be guessed at compile time. Please feel free to submit a PR!
And look at how slow it still is. 40ms to parse json? I can do that around or under 1ms in iOS. When porting our app to android this was one of the biggest unexpected bottlenecks that really impacts performance. I don't know why android doesn't provide a native json implementation to reduce this barrier to entry.
Surely the size of the JSON payload matters for this benchmark. Just saying you can parse json in under 1 ms is somewhat meaningless unless you're comparing similar sized json documents, as well as marshalling into a user-supplied class.
And that's exactly what I'm comparing. This was the shock that came from the same data being loaded into android as ios being over an order of magnitude slower.
Interesting. What are you using for object marshalling on iOS? And which json processor are you using on your android benchmark? The referenced library?
The two are not really comparable since you get different results (JSONObjects are not strongly typed). You will easily be able to find workloads where one is better than the other, but in the average case, ig-json-parser will probably be faster because it's based on Jackson. (see json/jackson/manual vs json/org.json/manual on https://github.com/eishay/jvm-serializers/wiki)