Closed
Bug 1051984
Opened 11 years ago
Closed 11 years ago
Use ujson to serialize JSON
Categories
(Socorro Graveyard :: Middleware, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
99
People
(Reporter: peterbe, Assigned: peterbe)
Details
Attachments
(2 files)
ujson is much faster than the plain json module and we're not using anything fancy when doing the dumps().
One interesting, but should be irrelevant, difference is that ujson doesn't bother with readable spaces after commas::
PLAIN JSON
{"hits": [{"id": 1041646, "signature": "mozilla::dom::exceptions::JSStackFrame::GetFilename(nsAString_internal&)"}], "total": 1}
UJSON
{"hits":[{"id":1041646,"signature":"mozilla::dom::exceptions::JSStackFrame::GetFilename(nsAString_internal&)"}],"total":1}
| Assignee | ||
Updated•11 years ago
|
Assignee: nobody → peterbe
Status: NEW → ASSIGNED
| Assignee | ||
Comment 1•11 years ago
|
||
I think this only matters on the /crash_data/ endpoint where the payload is big enough for there to be a time difference to make the dump string.
| Assignee | ||
Comment 2•11 years ago
|
||
Another interesting difference is how floating point numbers are serialized. Compare::
PLAIN JSON
{"hits": [["20140802030201", 39.173999999999999], ["20140803030203", 57.847999999999999], ["20140804030205", 21.591000000000001], ["20140805030300", 30.475000000000001], ["20140806030201", 11.906000000000001], ["20140807030202", 25.768000000000001], ["20140807084340", 46.316000000000003], ["20140808030201", 39.737000000000002], ["20140809030202", 40.337000000000003]], "total": 9}
UJSON
{"hits":[["20140802030201",39.174],["20140803030203",57.848],["20140804030205",21.591],["20140805030300",30.475],["20140806030201",11.906],["20140807030202",25.768],["20140807084340",46.316],["20140808030201",39.737],["20140809030202",40.337]],"total":9}
| Assignee | ||
Comment 3•11 years ago
|
||
Comparison with outliers that mess up the chart.
| Assignee | ||
Comment 4•11 years ago
|
||
Charts without the outliers ruining the comparison :)
| Assignee | ||
Comment 5•11 years ago
|
||
I measured what the middleware was doing for a while and summed it here::
PLAIN JSON
245 datapoints
Total bytes 20442428 19963 Kb
Total time 2.23465 seconds
UJSON
198 datapoints
Total bytes 15677215 15309 Kb
Total time 0.09736 seconds
Basically, the difference really does add up.
| Assignee | ||
Comment 6•11 years ago
|
||
Comment 7•11 years ago
|
||
Commits pushed to master at https://github.com/mozilla/socorro
https://github.com/mozilla/socorro/commit/0231a4c2f0c2e292b0969e62cf64ef23b45b8173
fixes bug 1051984 - Use ujson to serialize JSON
https://github.com/mozilla/socorro/commit/200312d8c2bba4b0f1f08c818a357d7336133455
Merge pull request #2282 from peterbe/bug-1051984-use-ujson-to-serialize-json
fixes bug 1051984 - Use ujson to serialize JSON
Updated•11 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Updated•11 years ago
|
Target Milestone: --- → 98
Updated•11 years ago
|
Target Milestone: 98 → 99
Updated•9 years ago
|
Product: Socorro → Socorro Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•