Skip to content

Latest commit

 

History

History
123 lines (116 loc) · 23.9 KB

File metadata and controls

123 lines (116 loc) · 23.9 KB

Serialization

serialize dumps()[1] Encoder()[2] dumps(n)[3] Encoder(n)[4] PyEncoder()[5] simdjson[6] orjson[7] ujson[8] simplejson[9] stdlib[10]
100 arrays dict 1.00 1.00 0.73 0.72 1.00 1.34 0.14 0.94 5.48 1.34
100 dicts array 1.00 1.00 0.79 0.76 1.00 1.55 0.20 0.96 6.73 1.53
256 Trues array 1.00 0.99 1.17 1.10 1.08 1.78 0.30 1.62 2.99 1.78
256 ascii array 1.00 1.00 1.01 1.00 1.00 1.04 0.09 0.54 1.18 1.04
256 doubles array 1.00 1.00 1.00 1.00 1.00 0.93 0.06 0.31 1.06 0.93
256 unicode array 1.00 0.99 1.01 1.00 0.99 0.77 0.02 0.62 0.78 0.77
apache.json 1.00 0.99 0.99 0.99 0.99 1.34 0.18 1.24 3.15 1.34
canada.json 1.00 1.00 0.99 0.99 1.01 1.03 0.09 0.36 1.91 1.02
complex object 1.00 1.00 0.90 0.89 1.01 1.25 0.17 0.80 2.92 1.24
composite object 1.00 0.98 0.72 0.70 0.98 1.43 0.20 0.97 2.68 1.43
ctm.json 1.00 0.97 0.72 0.72 0.97 1.37 0.21 1.26 5.89 1.35
github.json 1.00 1.00 0.97 0.96 1.00 1.13 0.14 1.00 2.13 1.13
instruments.json 1.00 0.99 0.76 0.76 0.99 1.31 0.19 1.04 2.82 1.30
mesh.json 1.00 1.00 0.88 0.88 1.00 0.92 0.12 0.38 1.21 0.93
truenull.json 1.00 1.00 1.06 1.00 1.01 1.23 0.28 1.80 2.22 1.22
tweet.json 1.00 1.00 0.98 0.94 1.00 1.32 0.19 1.02 2.73 1.32
twitter.json 1.00 1.00 0.95 0.94 1.00 1.07 0.16 1.01 1.97 1.08
overall 1.00 1.00 0.79 0.79 1.00 1.25 0.13 0.79 4.46 1.25

Deserialization

deserialize loads()[11] Decoder()[12] loads(n)[13] Decoder(n)[14] PyDecoder()[15] simdjson orjson ujson simplejson stdlib
100 arrays dict 1.00 1.00 0.89 0.88 1.29 0.81 0.52 0.89 1.06 0.95
100 dicts array 1.00 1.00 0.86 0.84 1.50 0.64 0.38 0.77 1.36 1.05
256 Trues array 1.00 1.01 1.08 1.05 1.13 0.93 0.36 0.93 1.39 1.31
256 ascii array 1.00 1.00 1.01 0.99 1.67 0.63 0.48 1.28 1.23 1.11
256 doubles array 1.00 1.01 0.23 0.23 1.01 0.20 0.17 0.61 1.08 1.12
256 unicode array 1.00 1.00 1.01 1.00 1.04 1.04 0.41 0.77 4.53 1.37
apache.json 1.00 1.01 1.00 1.00 1.45 0.72 0.49 0.95 0.98 0.90
canada.json 1.00 1.00 0.34 0.35 1.07 0.31 0.28 0.59 1.06 1.04
complex object 1.00 1.00 0.81 0.83 1.25 0.60 0.38 0.84 1.10 0.97
composite object 1.00 1.01 0.84 0.83 1.34 0.62 0.44 0.66 1.34 1.05
ctm.json 1.00 1.00 0.89 0.89 1.36 0.81 0.54 1.21 1.15 1.32
github.json 1.00 1.02 0.98 0.97 1.31 0.73 0.45 0.91 1.01 0.90
instruments.json 1.00 1.01 0.83 0.83 1.19 0.62 0.35 0.73 1.02 0.90
mesh.json 1.00 1.00 0.50 0.50 1.01 0.44 0.36 0.70 1.26 1.13
truenull.json 1.00 1.01 1.01 1.00 1.02 0.95 0.29 0.88 0.96 0.92
tweet.json 1.00 1.00 0.97 0.96 1.27 0.72 0.44 0.98 1.25 1.04
twitter.json 1.00 1.00 0.96 0.96 1.20 0.75 0.44 0.98 1.04 1.09
overall 1.00 1.00 0.84 0.83 1.27 0.76 0.49 0.87 1.07 0.96

ASCII vs UTF-8 Serialization

serialize rj ascii[16] rj utf8[17] uj ascii[18] uj utf8[19] sj ascii[20] sj utf8[21] json ascii[22] json utf8[23]
Long ASCII string 1.00 0.52 0.29 0.36 0.73 0.81 0.73 1.43
Long Unicode string 1.00 0.57 0.62 0.47 0.69 0.53 0.73 0.57
overall 1.00 0.56 0.53 0.44 0.70 0.61 0.73 0.80
[1]rapidjson.dumps()
[2]rapidjson.Encoder()
[3]rapidjson.dumps(number_mode=NM_NATIVE)
[4]rapidjson.Encoder(number_mode=NM_NATIVE)
[5]rapidjson.Encoder() subclassed in Python with no-op hook methods
[6]simdjson 3.12.3
[7]orjson 3.10.18
[8]ujson 5.10.0
[9]simplejson 3.20.1
[10]Python 3.13.5 standard library json
[11]rapidjson.loads()
[12]rapidjson.Decoder()
[13]rapidjson.loads(number_mode=NM_NATIVE)
[14]rapidjson.Decoder(number_mode=NM_NATIVE)
[15]rapidjson.Decoder() subclassed in Python with *no-op* hook methods
[16]rapidjson.dumps(ensure_ascii=True)
[17]rapidjson.dumps(ensure_ascii=False)
[18]ujson.dumps(ensure_ascii=True)
[19]ujson.dumps(ensure_ascii=False)
[20]simplejson.dumps(ensure_ascii=True)
[21]simplejson.dumps(ensure_ascii=False)
[22]stdlib json.dumps(ensure_ascii=True)
[23]stdlib json.dumps(ensure_ascii=False)