Skip to content

Commit

Permalink
Refresh the comparison tables, adding new "ASCII vs UTF-8" one
Browse files Browse the repository at this point in the history
  • Loading branch information
lelit committed May 13, 2018
1 parent 6cf3bb6 commit 60147e1
Showing 1 changed file with 44 additions and 22 deletions.
66 changes: 44 additions & 22 deletions docs/benchmarks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,23 @@ Serialization
+-----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+
| serialize | ``dumps()``\ [1]_ | ``Encoder()``\ [2]_ | ``dumps(n)``\ [3]_ | ``Encoder(n)``\ [4]_ | ujson\ [5]_ | simplejson\ [6]_ | stdlib\ [7]_ | yajl\ [8]_ |
+=======================+======================+======================+======================+======================+======================+======================+======================+======================+
| 100 arrays dict | 1.00 | 0.97 | 0.75 | **0.75** | 0.92 | 4.15 | 2.16 | 1.29 |
| 100 arrays dict | 1.00 | 1.00 | **0.71** | 0.71 | 0.86 | 3.47 | 2.09 | 1.25 |
+-----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+
| 100 dicts array | 1.00 | 1.04 | 0.84 | **0.82** | 1.08 | 5.29 | 2.22 | 1.35 |
| 100 dicts array | 1.00 | 1.03 | 0.80 | **0.75** | 0.83 | 4.73 | 2.14 | 1.19 |
+-----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+
| 256 Trues array | **1.00** | 1.17 | 1.21 | 1.22 | 1.50 | 2.93 | 2.25 | 1.32 |
| 256 Trues array | **1.00** | 1.09 | 1.18 | 1.07 | 1.37 | 2.88 | 2.44 | 1.29 |
+-----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+
| 256 ascii array | 1.00 | 1.01 | 1.04 | 1.04 | **0.52** | 1.21 | 1.05 | 1.24 |
| 256 ascii array | 1.00 | 1.00 | 1.01 | 1.00 | **0.48** | 1.08 | 1.03 | 0.85 |
+-----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+
| 256 doubles array | **1.00** | 1.02 | 1.12 | 1.02 | 6.94 | 7.90 | 8.26 | 4.02 |
| 256 doubles array | 1.00 | 1.00 | 1.01 | 1.00 | 1.22 | 1.12 | 0.98 | **0.71** |
+-----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+
| 256 unicode array | 1.00 | 0.86 | 0.87 | 0.85 | 0.55 | 0.72 | 0.65 | **0.52** |
| 256 unicode array | 1.00 | 0.86 | 0.86 | 0.86 | 0.54 | 0.71 | 0.88 | **0.51** |
+-----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+
| complex object | 1.00 | 1.01 | **0.85** | 0.88 | 1.02 | 3.86 | 2.56 | 2.09 |
| complex object | 1.00 | 1.00 | 0.92 | 0.91 | **0.65** | 2.19 | 1.56 | 1.28 |
+-----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+
| composite object | 1.00 | 1.02 | 0.73 | **0.70** | 0.87 | 2.79 | 1.83 | 1.88 |
| composite object | 1.00 | 1.02 | 0.73 | **0.70** | 0.83 | 2.50 | 1.66 | 1.72 |
+-----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+
| overall | 1.00 | 0.97 | 0.75 | **0.75** | 0.92 | 4.14 | 2.16 | 1.29 |
| overall | 1.00 | 1.00 | **0.71** | 0.71 | 0.86 | 3.46 | 2.09 | 1.25 |
+-----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+


Expand All @@ -54,37 +54,59 @@ Deserialization
+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+
| deserialize | ``loads()``\ [9]_ | ``Decoder()``\ [10]_ | ``loads(n)``\ [11]_ | ``Decoder(n)``\ [12]_ | ujson | simplejson | stdlib | yajl |
+=======================+=======================+=======================+=======================+=======================+=======================+=======================+=======================+=======================+
| 100 arrays dict | 1.00 | 1.00 | 0.90 | **0.89** | 0.96 | 1.52 | 1.17 | 1.14 |
| 100 arrays dict | 1.00 | 1.00 | **0.91** | 0.92 | 0.94 | 1.40 | 1.04 | 1.13 |
+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+
| 100 dicts array | 1.00 | 1.22 | **0.85** | 0.87 | 0.93 | 2.13 | 1.58 | 1.23 |
| 100 dicts array | 1.00 | 1.05 | **0.88** | 0.89 | 0.88 | 1.79 | 1.31 | 1.19 |
+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+
| 256 Trues array | **1.00** | 1.37 | 1.19 | 1.24 | 1.12 | 2.04 | 1.77 | 1.77 |
| 256 Trues array | **1.00** | 1.20 | 1.17 | 1.23 | 1.14 | 1.98 | 1.55 | 1.94 |
+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+
| 256 ascii array | **1.00** | 1.03 | 1.03 | 1.04 | 1.38 | 1.22 | 1.17 | 1.41 |
| 256 ascii array | **1.00** | 1.03 | 1.02 | 1.03 | 1.03 | 1.00 | 1.10 | 1.09 |
+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+
| 256 doubles array | 1.00 | 0.96 | 0.26 | **0.22** | 0.50 | 1.06 | 0.99 | 0.52 |
| 256 doubles array | 1.00 | 1.02 | **0.23** | 0.23 | 0.56 | 1.11 | 1.08 | 0.48 |
+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+
| 256 unicode array | **1.00** | 1.01 | 1.02 | 1.01 | 1.26 | 5.35 | 6.05 | 2.96 |
| 256 unicode array | **1.00** | 1.00 | 1.02 | 1.02 | 1.02 | 4.51 | 4.72 | 2.46 |
+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+
| complex object | 1.00 | 1.02 | 0.98 | **0.84** | 1.09 | 1.79 | 1.31 | 1.34 |
| complex object | 1.00 | 1.02 | 0.86 | **0.85** | 1.05 | 1.44 | 1.21 | 1.27 |
+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+
| composite object | 1.00 | 1.03 | 0.80 | 0.83 | **0.75** | 2.01 | 1.36 | 1.22 |
| composite object | 1.00 | 1.03 | 0.80 | 0.82 | **0.78** | 1.92 | 1.29 | 1.22 |
+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+
| overall | 1.00 | 1.00 | 0.90 | **0.89** | 0.96 | 1.52 | 1.18 | 1.14 |
| overall | 1.00 | 1.00 | **0.91** | 0.92 | 0.94 | 1.40 | 1.05 | 1.13 |
+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+


ASCII vs UTF-8 Serialization
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+-------------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+
| serialize | ``rj ascii``\ [13]_ | ``rj utf8``\ [14]_ | ``uj ascii``\ [15]_ | ``uj utf8``\ [16]_ | ``sj ascii``\ [17]_ | ``sj utf8``\ [18]_ | ``json ascii``\ [19]_ | ``json utf8``\ [20]_ |
+=========================+=======================+=======================+=======================+=======================+=======================+=======================+=======================+=======================+
| Long ASCII string | 1.00 | 0.48 | **0.23** | 0.49 | 0.66 | 1.32 | 0.60 | 1.13 |
+-------------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+
| Long Unicode string | 1.00 | 0.62 | 0.64 | 0.63 | 0.80 | 0.62 | 0.98 | **0.55** |
+-------------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+
| overall | 1.00 | 0.57 | **0.51** | 0.58 | 0.76 | 0.84 | 0.86 | 0.74 |
+-------------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------+

.. [1] ``rapidjson.dumps()``
.. [2] ``rapidjson.Encoder()``
.. [3] ``rapidjson.dumps(number_mode=NM_NATIVE)``
.. [4] ``rapidjson.Encoder(number_mode=NM_NATIVE)``
.. [5] `ujson 1.35 <https://pypi.python.org/pypi/ujson/1.35>`__
.. [6] `simplejson 3.13.2 <https://pypi.python.org/pypi/simplejson/3.13.2>`__
.. [7] Python 3.6.4 standard library ``json``
.. [8] `yajl 0.3.5 <https://pypi.python.org/pypi/yajl/0.3.5>`__
.. [5] `ujson 1.35 <https://pypi.org/pypi/ujson/1.35>`__
.. [6] `simplejson 3.13.2 <https://pypi.org/pypi/simplejson/3.13.2>`__
.. [7] Python 3.6.5 standard library ``json``
.. [8] `yajl 0.3.5 <https://pypi.org/pypi/yajl/0.3.5>`__
.. [9] ``rapidjson.loads()``
.. [10] ``rapidjson.Decoder()``
.. [11] ``rapidjson.loads(number_mode=NM_NATIVE)``
.. [12] ``rapidjson.Decoder(number_mode=NM_NATIVE)``
.. [13] ``rapidjson.dumps(ensure_ascii=True)``
.. [14] ``rapidjson.dumps(ensure_ascii=False)``
.. [15] ``ujson.dumps(ensure_ascii=True)``
.. [16] ``ujson.dumps(ensure_ascii=False)``
.. [17] ``simplejson.dumps(ensure_ascii=True)``
.. [18] ``simplejson.dumps(ensure_ascii=False)``
.. [19] ``stdlib json.dumps(ensure_ascii=True)``
.. [20] ``stdlib json.dumps(ensure_ascii=False)``
DIY
Expand Down

0 comments on commit 60147e1

Please sign in to comment.