Live data from Hacker News

Json vs. simplejson vs. ujson

jyotiska.github.io

11–20 of 75 posts

Re: Json vs. simplejson vs. ujson

#14
post #7

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…

Hey Jason. Thats pretty interesting. I have also noticed similar things but for my case, we needed faster loading/unloading for some cases, hence ujson.

Re: Json vs. simplejson vs. ujson

#15
I disagree with the conclusion. How about this: you should use the tool that most of your coworkers already know and which has large community support and adequate performance. In other words, stop foling around and use json library. If (IF!!!) you find performance inadequate, try the other libraries. And most of all, if optimization is your goal: measure, measure and measure!

Re: Json vs. simplejson vs. ujson

#17

> keep in mind that ultrajson only works with well defined collections and will not work for un-serializable collections. But if you are dealing with texts, this should not be a problem. Well-defined collections? As in, serializable? Well sure, that's requisite for the native json package as well as simplejson (as far as I can recall -- haven't used simplejson in some time.) But does "texts" refer to strings? As in,…

ujson doesn't error out if you have a collection that isn't serializable so you can lose individual keys. It also has issues with ints and floats that are too big (just fails out)

Re: Json vs. simplejson vs. ujson

#19

How 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.

What I found interesting is that the original version had plain HTML tables, not ascii in images: http://blog.dataweave.in/post/87589606893/json-vs-simplejson...

Re: Json vs. simplejson vs. ujson

#20
post #7

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.
Post reply on HN