When I wrote the same kind of article in Nov 2011 [1], I came to similar conculsions; ujson was blowing everyone away. However, after swapping a fairly large and json-intensive production spider over to ujson, we noticed a large increase in memory use. When I investigated, I discovered that simplejson reused allocated string objects, so when parsing/loading you basically got string compression for repeated string key…
Seems like there should be a standard Python mechanism for constructing "atoms" or "symbols" that automatically get commoned up.
Json vs. simplejson vs. ujson
21–30 of 75 posts
Re: Json vs. simplejson vs. ujson
#22Re: Json vs. simplejson vs. ujson
#23I leave this here in case it helps others.
We had other focus such as good for both python and java.
At the time we went msgpack. As msgpack is doing much the same work as json, it just shows that the magic is in the code not the format..)
Re: Json vs. simplejson vs. ujson
#24What about larger dictionaries? With such a small one I would be worried that a significant proportion of the time would be simple overhead.
[Warning: Anecdote] When we were testing out the various JSON libraries we found simplejson much faster than json for dumps. We used large dictionaries.
Was the simplejson package using its optimized C library?
Re: Json vs. simplejson vs. ujson
#25How hard is it to draw a bar graph? I'd imagine it is easier than creating an ASCII table and then turning that into an image, but I've never experimented with the latter.
Re: Json vs. simplejson vs. ujson
#26> We have a dictionary with 3 keys What about larger dictionaries? With such a small one I would be worried that a significant proportion of the time would be simple overhead. [Warning: Anecdote] When we were testing out the various JSON libraries we found simplejson much faster than json for dumps. We used large dictionaries. Was the simplejson package using its optimized C library?
I completely failed to read this the first time I went through. I guess this is equivalent to dumping bigger dictionaries.
> [Warning: Anecdote] When we were testing out the various JSON libraries we found simplejson much faster than json for dumps.
Turns out we were using sort_keys=True option, which apparently makes simplejson much faster than json.
Re: Json vs. simplejson vs. ujson
#27Its syntax is nginx-like but can also parse strict json. It's pretty fast too.
More info here: https://github.com/vstakhov/libucl
Re: Json vs. simplejson vs. ujson
#28I just want to add another library in here which – at least in my world – is replacing json as the number one configuration and serialisation format. It's called libucl and it's main consumer is probably the new package tool in FreeBSD: `pkg` Its syntax is nginx-like but can also parse strict json. It's pretty fast too. More info here: https://github.com/vstakhov/libucl
Re: Json vs. simplejson vs. ujson
#29Re: Json vs. simplejson vs. ujson
#30When I wrote the same kind of article in Nov 2011 [1], I came to similar conculsions; ujson was blowing everyone away. However, after swapping a fairly large and json-intensive production spider over to ujson, we noticed a large increase in memory use. When I investigated, I discovered that simplejson reused allocated string objects, so when parsing/loading you basically got string compression for repeated string key…
Seems like there should be a standard Python mechanism for constructing "atoms" or "symbols" that automatically get commoned up.