json_benchmark

July 13, 2026 ยท View on GitHub

:grey_exclamation: Benchmarks regenerated on 2026-07-13

This repository contains benchmarks for Python JSON readers & writers. What's the fastest Python JSON parser? Let's find out.

To run the tests yourself:

git clone git@github.com:TkTech/json_benchmark.git && cd json_benchmark
<setup a virtualenv using your tool of choice>
poetry install
pytest --benchmark-json benchmark.json --benchmark-histogram histograms/

To update the tables in the README.md with the new results, just run:

python generate_benchmark_summaries.py
python generate_minefield_reports.py

Candidate Libraries

The following libraries are the current candidates for benchmarking. Feel free to request or add new libraries.

LibraryReaderWriterStreamingVersion
simdjsonYesNoNo7.0.3
cysimdjsonYesNoNo23.9
yyjsonYesYesYes5.0.0
orjsonYesYesNo3.11.9
rapidjsonYesYesNo1.23
ujsonYesYesNo5.13.0
jsonYesYesNo3.11
msgspecYesYesNo0.21.1
ijsonYesNoYes3.5.1

"Streaming" indicates a SAX-style / incremental parser that dispatches JSON tokens without building the whole document in memory. These are compared separately in the "Streaming parse of ..." benchmark groups.

Correctness

cd It doesn't matter how fast a JSON parser is if it's not going to give you the correct results. We run the JSON minefield against each library. To see the complete line-by-line results, see the <minefield_reports/> directory.

yyjson

See full minefield results for yyjson.

countresult
283๐ŸŽ‰ expected result
0๐Ÿ”ฅ parsing should have failed but succeeded
0๐Ÿ”ฅ parsing should have succeeded but failed
6โž• result undefined, parsing succeeded
29โž– result undefined, parsing failed

yyjson-sax

See full minefield results for yyjson-sax.

countresult
283๐ŸŽ‰ expected result
0๐Ÿ”ฅ parsing should have failed but succeeded
0๐Ÿ”ฅ parsing should have succeeded but failed
6โž• result undefined, parsing succeeded
29โž– result undefined, parsing failed

rapidjson

See full minefield results for rapidjson.

countresult
277๐ŸŽ‰ expected result
6๐Ÿ”ฅ parsing should have failed but succeeded
0๐Ÿ”ฅ parsing should have succeeded but failed
6โž• result undefined, parsing succeeded
29โž– result undefined, parsing failed

orjson

See full minefield results for orjson.

countresult
283๐ŸŽ‰ expected result
0๐Ÿ”ฅ parsing should have failed but succeeded
0๐Ÿ”ฅ parsing should have succeeded but failed
6โž• result undefined, parsing succeeded
29โž– result undefined, parsing failed

simdjson

See full minefield results for simdjson.

countresult
283๐ŸŽ‰ expected result
0๐Ÿ”ฅ parsing should have failed but succeeded
0๐Ÿ”ฅ parsing should have succeeded but failed
4โž• result undefined, parsing succeeded
31โž– result undefined, parsing failed

ujson

See full minefield results for ujson.

countresult
267๐ŸŽ‰ expected result
16๐Ÿ”ฅ parsing should have failed but succeeded
0๐Ÿ”ฅ parsing should have succeeded but failed
21โž• result undefined, parsing succeeded
14โž– result undefined, parsing failed

msgspec

See full minefield results for msgspec.

countresult
283๐ŸŽ‰ expected result
0๐Ÿ”ฅ parsing should have failed but succeeded
0๐Ÿ”ฅ parsing should have succeeded but failed
6โž• result undefined, parsing succeeded
29โž– result undefined, parsing failed

ijson

See full minefield results for ijson.

countresult
282๐ŸŽ‰ expected result
1๐Ÿ”ฅ parsing should have failed but succeeded
0๐Ÿ”ฅ parsing should have succeeded but failed
16โž• result undefined, parsing succeeded
19โž– result undefined, parsing failed

Performance

In these benchmarks, lower is better.

Streaming parse of data/canada.json

Sample file is 2251051 bytes.

librarymin (ms)max (ms)mean (ms)
yyjson8.69709.30078.8893
ijson (yajl2_c)22.685823.865223.1013

Streaming parse of data/citm_catalog.json

Sample file is 1727204 bytes.

librarymin (ms)max (ms)mean (ms)
yyjson3.32774.88243.7323
ijson (yajl2_c)6.30188.59756.9487

Streaming parse of data/twitter.json

Sample file is 631514 bytes.

librarymin (ms)max (ms)mean (ms)
yyjson1.79402.08591.8278
ijson (yajl2_c)2.82675.34362.9626

Streaming parse of data/verysmall.json

Sample file is 7 bytes.

librarymin (ms)max (ms)mean (ms)
yyjson0.00110.02120.0012
ijson (yajl2_c)0.00370.12670.0039

Streaming parse of data/fgo.json

Sample file is 48765043 bytes.

librarymin (ms)max (ms)mean (ms)
yyjson315.4146319.3040317.5809
ijson (yajl2_c)495.1035505.1622499.9637

Streaming parse of data/otfcc.json

Sample file is 66409302 bytes.

librarymin (ms)max (ms)mean (ms)
yyjson646.0111659.2554651.9847
ijson (yajl2_c)1020.10021032.14421027.0863

Streaming parse of data/poet.json

Sample file is 3512883 bytes.

librarymin (ms)max (ms)mean (ms)
yyjson7.648211.54927.8543
ijson (yajl2_c)9.36709.65949.5128

Streaming parse of data/gsoc-2018.json

Sample file is 3327831 bytes.

librarymin (ms)max (ms)mean (ms)
yyjson4.73805.49314.8932
ijson (yajl2_c)5.10255.90485.2717

Complete load of data/canada.json

Sample file is 2251051 bytes.

librarymin (ms)max (ms)mean (ms)
yyjson4.49916.74864.8984
orjson6.014620.894612.1758
msgspec6.608227.977915.5113
simdjson7.270120.671214.5211
ujson11.129325.248918.3757
json23.841734.656928.9730
rapidjson24.671839.564832.8370

Complete load of data/citm_catalog.json

Sample file is 1727030 bytes.

librarymin (ms)max (ms)mean (ms)
yyjson1.78383.23571.9707
orjson2.419413.51994.6141
msgspec3.088921.46276.3947
simdjson3.392716.41616.1467
ujson4.474219.05787.3929
rapidjson4.516521.79927.4734
json6.232014.98187.9924

Complete load of data/twitter.json

Sample file is 567916 bytes.

librarymin (ms)max (ms)mean (ms)
orjson0.809513.53491.1043
yyjson0.86941.50640.9441
msgspec1.057717.20881.4776
simdjson1.393314.95751.7529
ujson1.698214.89082.1086
rapidjson1.862715.83462.2719
json2.685113.79342.9656

Complete load of data/verysmall.json

Sample file is 7 bytes.

librarymin (ms)max (ms)mean (ms)
msgspec0.00010.00390.0001
yyjson0.00010.00250.0001
orjson0.00010.00170.0001
rapidjson0.00030.00170.0003
ujson0.00030.00430.0003
simdjson0.00040.00980.0004
json0.00080.00490.0008

Complete load of data/fgo.json

Sample file is 45690911 bytes.

librarymin (ms)max (ms)mean (ms)
yyjson226.2088239.0445230.9776
orjson470.7608544.2078507.9765
msgspec474.9090539.3030508.0502
rapidjson607.6599671.6313642.6487
json658.0721700.5949674.1365
ujson795.8875926.3975873.1998
simdjson852.5420919.4318881.5412

Complete load of data/otfcc.json

Sample file is 66409251 bytes.

librarymin (ms)max (ms)mean (ms)
yyjson559.2589575.5079570.1669
msgspec1051.57801180.52351115.4705
orjson1105.12281175.15321142.0121
ujson1286.00611469.60671364.5810
rapidjson1296.96911427.18101359.3918
simdjson1357.05201529.26941430.5631
json1572.20351680.60501615.5561

Complete load of data/poet.json

Sample file is 1707203 bytes.

librarymin (ms)max (ms)mean (ms)
orjson4.42885.20354.5914
yyjson4.61315.31944.7907
msgspec4.71126.76245.3332
simdjson5.22426.58575.4582
ujson5.70278.04376.4811
json6.36859.78027.2586
rapidjson7.42188.23767.6006

Complete load of data/gsoc-2018.json

Sample file is 3327831 bytes.

librarymin (ms)max (ms)mean (ms)
msgspec2.502314.69733.0122
yyjson2.54523.12162.6679
simdjson2.836317.30133.2583
orjson3.574414.21823.7913
rapidjson4.300717.69944.7676
json4.470816.95585.2436
ujson4.662722.67035.6661

Merge Patch

librarymin (ms)max (ms)mean (ms)
json_merge_patch0.00050.08030.0007
yyjson0.00100.02770.0011

FAQ

Why doesn't this run benchmarks using Github Actions?

Generally, unless you control the CI runners with self-hosted boxes (which are unsafe on public Github projects!), you have no idea what machine you're going to get, or how many other jobs may be running on the same machine. This can cause the benchmarks to vary drastically between runs, even minutes apart. For this reason benchmarks are always run locally on a consistent machine, in a consistent state.

What machine is used for the x64 benchmarks?

x64 tests are run on an AMD Ryzen 7 5800X, capped at base clock speed with 64GB of Corsair CMW32GX4M2E3200C16.

JSON is terrible, use X!

This repository isn't for arguing the pros or cons of JSON versus some other exchange format. You frequently have no choice but to work with JSON, and if you can read or write responses 15% faster, that means you can handle more requests per second with the same hardware.