[openstack-dev] [all] ujson "drop in" replacement

Graham Hayes gr at ham.ie
Wed Nov 1 19:00:05 UTC 2017


Hey all,

There seems to be a lot of "replace oslo.serization / native python json
with UltraJSON (otherwise known as ujson) patches over the last few
weeks.

We should be careful - it is not a drop in replacement. e.g. -

Normal python JSON:

    >>> import json
    >>> json.dumps({"url":"https://google.com"})
    '{"url": "https://google.com"}'

ujson:

    >>> import ujson as json
    >>> json.dumps({"url":"https://google.com"})
    '{"url":"https:\\/\\/google.com"}'

It is not currently in use in many projects:

    curl -X POST http://codesearch.openstack.org/api/v1/search -F
q=ujson -F repos='*' -F files="requirements\.txt" -f  -s | jq '.Results
| keys'
    [
      "ceilometer",
      "kiloeyes",
      "monasca-common",
      "requirements",
      "rpm-packaging"
    ]

I personally do not see the point in adding another dependency that has
weird behaviour for an as yet unmeasured performance increase.

- Graham

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 455 bytes
Desc: OpenPGP digital signature
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20171101/cfed6e4f/attachment.sig>


More information about the OpenStack-dev mailing list