matrix-org / synapse

Synapse: Matrix homeserver written in Python/Twisted.
https://matrix-org.github.io/synapse
Apache License 2.0
11.79k stars 2.13k forks source link

Check if we broke performance by switching from ujson to simplejson #3009

Closed ara4n closed 6 years ago

ara4n commented 6 years ago

And whet we'd be better off pinning against a non-broken version of ujson (as apparently the upstream git is fixed).

See https://github.com/matrix-org/synapse/pull/3008

richvdh commented 6 years ago

Empirically, no we haven't broken performance, since matrix.org is now using simplejson without a catastrophic decrease in performance.

I have spent some time profiling ujson, simplejson and json; the results look like this:

image

(In the above, simplejson uses simplejson.dumps; simplejson_static creates a static JSONEncoder and JSONDecoder and uses encode and decode).

Conclusions are:

Despite that, I think we want to use simplejson anyway. The reasons for this are:

As part of this work, I've also discovered that canonicaljson is slow (4x slower than simplejson for canonicaljson 1.0.0, though this is reduced to 1.5x in canonicaljson 1.1.0).

richvdh commented 6 years ago

Keeping this open for now, until we merge canonicaljson 1.1.0

richvdh commented 6 years ago

Canonicaljson 1.1.2 is now released, and matrix.org is using it.