jsonifier icon indicating copy to clipboard operation
jsonifier copied to clipboard

Is jsonifier slower than aeson on real-world data?

Open mitchellwrosen opened this issue 2 years ago • 6 comments
trafficstars

In this comment, @KtorZ reports that jsonifier is slower than aeson.

Let's get to the bottom of this! @KtorZ, could you share any benchmarks you have that demonstrate this, or maybe a link to a discussion from some other forum?

mitchellwrosen avatar Jan 05 '23 14:01 mitchellwrosen

To give some context, this comment mostly stemmed from empirical measurement and benchmarks using profiling on this project: https://github.com/CardanoSolutions/ogmios -- which has heavy needs on JSON-serialization (hundred of megabytes of data per second).

I originally planned to give jsonifier a try after seeing some blog post / reddit post about it, and as recorded here. I ended up abandoning this decision in favor of aeson's encoding API (see 006) which turned out to be more interoperable and actually faster than jsonifier on the profiling.

What is also absolutely certain is that the default API of aeson (constructing Haskell Value and then serializing) is about twice as slow as encoding JSON directly.

Note also that, this happened 2 years ago. I don't know what's the state of the library today.

KtorZ avatar Jan 05 '23 14:01 KtorZ

Excellent, thanks for the context.

mitchellwrosen avatar Jan 05 '23 21:01 mitchellwrosen

Hey guys! Thanks for the report. Is it possible to narrow this down to a benchmark or a set of benchmarks that highlights the difference?

nikita-volkov avatar Jan 06 '23 23:01 nikita-volkov

Just to be clear from my end: I am not particularly interested in this conversation / outcome. I've got other matters to tackle and I was merely providing a bit of context.

Best of luck 🍀

KtorZ avatar Jan 09 '23 12:01 KtorZ

@mitchellwrosen So where do we go from here? The specified links only provide vague claims and no way to reproduce. I'm really interested in getting to the bottom of this.

nikita-volkov avatar Jan 19 '23 07:01 nikita-volkov

Indeed; I had considered trying to put together a benchmark. I'm sure enormous gobs of "real world" JSON aren't hard to generate or get a hold of.

However, life took over, so I haven't gotten around to doing anything yet.

Feel free to close this issue if you'd like - I may come through with some benchmarks at a later date and re-open if no one else has investigated by then.

mitchellwrosen avatar Jan 19 '23 16:01 mitchellwrosen