News for hackers. Stuff that matters.
Re:PyPy's New JSON Parser by slovenlyrobot on Tuesday October 08, 2019 @09:56AM (#21192333)
This post touches briefly on ujson. I found it a long time ago, and while I can't vouch for the quality of its implementation, it's very popular and seems to work just fine. Any time I've encountered a bottleneck due to parsing, dropping ujson.loads() in has made it completely vanish from profiling output.
Re:PyPy's New JSON Parser by ambivalence on Tuesday October 08, 2019 @10:21AM (#21192590)
Please note that according to the benchmark in this blogpost, CPython's builtin JSON decoder is faster than ujson.
Re:PyPy's New JSON Parser by gshulegaard on Tuesday October 08, 2019 @11:28AM (#21193336)
That result is actually why I am healthily skeptical of the performance comparisons specifically in this post. Like the previous comment I too have been in a situation where JSON encode/decode on large payloads were significant enough that we decided we needed to figure out something more optimal. Our solution was to use ujson instead (of the built in) and that was good enough that we moved on.

When I say skeptical what I mean is that I have no doubt the measurements are accurate (as in not fabricated); however, I wonder what the full context of the benchmarks are and whether or not it's representative of situations like mine where the built-in parser started to fall over so we replaced it. It may also be the case that the PyPy parser would also beat ujson in this case, but if we are limiting our test case to just those where the CPython implementation is marginally faster than ujson then I'm not sure it's that useful a benchmark.

I too cannot comment on the quality of the implementation or the relative performance against other parsers...but it solved a performance problem for at least one project of mine in the past.

Re:PyPy's New JSON Parser by kmod on Tuesday October 08, 2019 @02:06PM (#21195139)
Agreed, I've gotten huge speedups from ujson in the past and the numbers in the post are markedly different from my experience, making me think that they are measuring something different / there is something significant about this use case that is different than the ones I've had in the past.
Re:PyPy's New JSON Parser by weberc2 on Tuesday October 08, 2019 @02:54PM (#21195738)
The post is profiling large payloads? Maybe ujson is optimized for smaller payloads?
Re:PyPy's New JSON Parser by wyldfire on Tuesday October 08, 2019 @10:35AM (#21192763)
It's not strictly the case (`reddit` case).

But the difference is pretty insignificant compared to Node and PyPyFull.

Re:PyPy's New JSON Parser by superwayne on Tuesday October 08, 2019 @10:05AM (#21192420)
I think there are even faster JSON parsers out there nowadays. I have recently used orjson and found it to be extremely fast for our use case (serializing a dict with about 100 MB).