Closed Bug 1193522 Opened 9 years ago Closed 9 years ago

[mozlog] Use UltraJSON if available for perf

Categories

(Testing :: Mozbase, defect)

defect
Not set
normal

Tracking

(firefox43 fixed)

RESOLVED FIXED
mozilla43
Tracking Status
firefox43 --- fixed

People

(Reporter: ahal, Assigned: ahal)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

People have profiled ujson [1] being 400-600% faster than json. I did an unscientific test, and without ujson, we spend ~5 seconds in json.dumps during a build. With ujson, we only spend ~0.4s.

Seems worth using if we can. Also seems like it might be worth checking into the tree.

[1] https://github.com/esnme/ultrajson
Note: ujson gets some of it's performance boosts by doing no validation on the validity of data being serialized/deserialized, see [1].

I think this is ok for us, since we already do that in logtypes.py. The stdlib json module is probably doing unnecessary validation for us atm.

[1] http://mod16.org/hurfdurf/?p=266
Also, for pulse_actions we switched away from json for memory issues to ijson:
http://explique.me/Ijson
I'm OK with using ujson since we pre-validate the data anyway. It might be nice to know if that would also work for the pulse usecase so that we can avoid using 3 different json libraries in different parts of the tree.
Bug 1193522 - [mozlog] Use ultrajson instead of stdlib json if available for performance, r=jgraham
Attachment #8647617 - Flags: review?(james)
Attachment #8647617 - Flags: review?(james) → review+
Comment on attachment 8647617 [details]
MozReview Request: Bug 1193522 - [mozlog] Use ultrajson instead of stdlib json if available for performance, r=jgraham

https://reviewboard.mozilla.org/r/16023/#review14295

Ship It!
Blocks: 1027665
https://hg.mozilla.org/mozilla-central/rev/aa9cc17290fc
Assignee: nobody → ahalberstadt
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla43
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: