You're including disk access and whatnot in your speed comparison. Using dumps and loads would probably be more indicative.
This prompted me to speed test between cJSON and simplejson because I'd heard that cJSON was faster. Turns out that it's faster on reads and slower on writes:
Comment
You're including disk access and whatnot in your speed comparison. Using dumps and loads would probably be more indicative.
This prompted me to speed test between cJSON and simplejson because I'd heard that cJSON was faster. Turns out that it's faster on reads and slower on writes:
raw length: 5182477
simplejson: {'write': 0.29880690574645996, 'read': 0.37422609329223633}
cjson: {'write': 0.37676501274108887, 'read': 0.21609997749328613}
That's an average of 10 runs for the encoding/decoding speed to a string for a 5MB array of 21k json objects on a 2.2GHz MBP.