{"id":16713998,"url":"https://github.com/tktech/json_benchmark","last_synced_at":"2025-09-19T05:08:12.209Z","repository":{"id":41034023,"uuid":"482056478","full_name":"TkTech/json_benchmark","owner":"TkTech","description":"Python JSON benchmarking and \"correctness\".","archived":false,"fork":false,"pushed_at":"2023-09-05T02:36:09.000Z","size":818,"stargazers_count":31,"open_issues_count":2,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-04T16:46:59.117Z","etag":null,"topics":["json","python"],"latest_commit_sha":null,"homepage":"https://tkte.ch","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TkTech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"TkTech","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2022-04-15T18:56:18.000Z","updated_at":"2025-03-23T11:17:17.000Z","dependencies_parsed_at":"2024-10-19T04:01:10.594Z","dependency_job_id":null,"html_url":"https://github.com/TkTech/json_benchmark","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/TkTech/json_benchmark","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TkTech%2Fjson_benchmark","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TkTech%2Fjson_benchmark/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TkTech%2Fjson_benchmark/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TkTech%2Fjson_benchmark/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TkTech","download_url":"https://codeload.github.com/TkTech/json_benchmark/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TkTech%2Fjson_benchmark/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275058117,"owners_count":25398168,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-14T02:00:10.474Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["json","python"],"created_at":"2024-10-12T20:48:46.746Z","updated_at":"2025-09-19T05:08:07.150Z","avatar_url":"https://github.com/TkTech.png","language":"Python","funding_links":["https://github.com/sponsors/TkTech"],"categories":[],"sub_categories":[],"readme":"# json_benchmark\n\n\u003c!-- start_last_updated_block --\u003e\n\n\n\u003e :grey_exclamation: Benchmarks regenerated on 2023-09-05\n\n\u003c!-- end_last_updated_block --\u003e\n\n\nThis repository contains benchmarks for **Python** JSON readers \u0026 writers.\nWhat's the fastest Python JSON parser? Let's find out.\n\nTo run the tests yourself:\n\n```bash\ngit clone git@github.com:TkTech/json_benchmark.git \u0026\u0026 cd json_benchmark\n\u003csetup a virtualenv using your tool of choice\u003e\npoetry install\npytest --benchmark-json benchmark.json --benchmark-histogram histograms/\n```\n\nTo update the tables in the README.md with the new results, just run:\n\n```\npython generate_benchmark_summaries.py\npython generate_minefield_reports.py\n```\n\n## Candidate Libraries\n\nThe following libraries are the current candidates for benchmarking. Feel free\nto request or add new libraries.\n\n| Library    | Reader | Writer | Version |\n|------------|--------|--------|---------|\n| simdjson   | Yes    | No     | 6.0.0   |\n| cysimdjson | Yes    | No     | 23.9    |\n| yyjson     | Yes    | Yes    | 2.3.1   |\n| orjson     | Yes    | Yes    | 3.9.5   |\n| rapidjson  | Yes    | Yes    | 1.10    |\n| ujson      | Yes    | Yes    | 5.8.0   |\n| json       | Yes    | Yes    | 3.11    |\n| msgspec    | Yes    | Yes    | 0.18.2  |\n\n## Correctness\n\ncd\nIt doesn't matter how fast a JSON parser is if it's not going to give you the\ncorrect results. We run the JSON minefield against each library. To see the\ncomplete line-by-line results, see the \u003cminefield_reports/\u003e\ndirectory.\n\n\u003c!-- start_correct_block --\u003e\n\n\n### yyjson\n\nSee full minefield results for [yyjson](minefield_reports/yyjson.md).\n\n| count | result |\n| ----- | ------ |\n| 283 | 🎉 expected result |\n| 0 | 🔥 parsing should have failed but succeeded |\n| 0 | 🔥 parsing should have succeeded but failed |\n| 6 | ➕ result undefined, parsing succeeded |\n| 29 | ➖ result undefined, parsing failed |\n\n### rapidjson\n\nSee full minefield results for [rapidjson](minefield_reports/rapidjson.md).\n\n| count | result |\n| ----- | ------ |\n| 277 | 🎉 expected result |\n| 6 | 🔥 parsing should have failed but succeeded |\n| 0 | 🔥 parsing should have succeeded but failed |\n| 6 | ➕ result undefined, parsing succeeded |\n| 29 | ➖ result undefined, parsing failed |\n\n### orjson\n\nSee full minefield results for [orjson](minefield_reports/orjson.md).\n\n| count | result |\n| ----- | ------ |\n| 283 | 🎉 expected result |\n| 0 | 🔥 parsing should have failed but succeeded |\n| 0 | 🔥 parsing should have succeeded but failed |\n| 6 | ➕ result undefined, parsing succeeded |\n| 29 | ➖ result undefined, parsing failed |\n\n### simdjson\n\nSee full minefield results for [simdjson](minefield_reports/simdjson.md).\n\n| count | result |\n| ----- | ------ |\n| 283 | 🎉 expected result |\n| 0 | 🔥 parsing should have failed but succeeded |\n| 0 | 🔥 parsing should have succeeded but failed |\n| 3 | ➕ result undefined, parsing succeeded |\n| 32 | ➖ result undefined, parsing failed |\n\n### ujson\n\nSee full minefield results for [ujson](minefield_reports/ujson.md).\n\n| count | result |\n| ----- | ------ |\n| 267 | 🎉 expected result |\n| 16 | 🔥 parsing should have failed but succeeded |\n| 0 | 🔥 parsing should have succeeded but failed |\n| 21 | ➕ result undefined, parsing succeeded |\n| 14 | ➖ result undefined, parsing failed |\n\n### msgspec\n\nSee full minefield results for [msgspec](minefield_reports/msgspec.md).\n\n| count | result |\n| ----- | ------ |\n| 283 | 🎉 expected result |\n| 0 | 🔥 parsing should have failed but succeeded |\n| 0 | 🔥 parsing should have succeeded but failed |\n| 6 | ➕ result undefined, parsing succeeded |\n| 29 | ➖ result undefined, parsing failed |\n\n\u003c!-- end_correct_block --\u003e\n\n\n## Performance\n\nIn these benchmarks, lower is better.\n\n\u003c!-- start_performance_block --\u003e\n\n\n### Complete load of data/canada.json\n\nSample file is 2251051 bytes.\n\n![](histograms/-Complete_load_of_data_canada.json.svg 'Histogram for Complete load of data/canada.json.')\n\n| library | min (ms) | max (ms) | mean (ms) |\n| ------- | -------- | -------- | --------- |\n| orjson | 5.0019 | 14.1927 | 9.6857 |\n| simdjson | 5.8214 | 18.1483 | 11.5799 |\n| msgspec | 5.9027 | 16.1104 | 10.1492 |\n| cysimdjson | 5.9696 | 14.7102 | 9.1315 |\n| yyjson | 6.1175 | 21.2752 | 12.7247 |\n| ujson | 10.1714 | 24.2481 | 16.5537 |\n| json | 21.6314 | 30.1396 | 26.0608 |\n| rapidjson | 23.4999 | 34.4533 | 29.2562 |\n\n\n### Complete load of data/citm_catalog.json\n\nSample file is 1727030 bytes.\n\n![](histograms/-Complete_load_of_data_citm_catalog.json.svg 'Histogram for Complete load of data/citm_catalog.json.')\n\n| library | min (ms) | max (ms) | mean (ms) |\n| ------- | -------- | -------- | --------- |\n| orjson | 2.2511 | 12.9107 | 3.9478 |\n| yyjson | 2.7017 | 17.0122 | 5.3347 |\n| simdjson | 2.8785 | 15.3378 | 5.0631 |\n| msgspec | 2.9459 | 13.9166 | 4.5182 |\n| cysimdjson | 3.0251 | 8.7956 | 4.0554 |\n| rapidjson | 4.7612 | 15.9753 | 6.7336 |\n| ujson | 4.8497 | 19.4423 | 7.4472 |\n| json | 4.9647 | 11.9016 | 6.2808 |\n\n\n### Complete load of data/twitter.json\n\nSample file is 567916 bytes.\n\n![](histograms/-Complete_load_of_data_twitter.json.svg 'Histogram for Complete load of data/twitter.json.')\n\n| library | min (ms) | max (ms) | mean (ms) |\n| ------- | -------- | -------- | --------- |\n| orjson | 0.8254 | 9.2997 | 0.9887 |\n| yyjson | 0.9115 | 13.4172 | 1.1653 |\n| simdjson | 0.9708 | 11.7451 | 1.1930 |\n| msgspec | 1.0621 | 10.1093 | 1.2256 |\n| cysimdjson | 1.3525 | 7.0623 | 1.4850 |\n| rapidjson | 2.0156 | 12.0504 | 2.2450 |\n| json | 2.1043 | 9.7267 | 2.2753 |\n| ujson | 2.2015 | 14.4491 | 2.4740 |\n\n\n### Complete load of data/verysmall.json\n\nSample file is 7 bytes.\n\n![](histograms/-Complete_load_of_data_verysmall.json.svg 'Histogram for Complete load of data/verysmall.json.')\n\n| library | min (ms) | max (ms) | mean (ms) |\n| ------- | -------- | -------- | --------- |\n| msgspec | 0.0001 | 0.0003 | 0.0001 |\n| orjson | 0.0001 | 0.0003 | 0.0001 |\n| simdjson | 0.0002 | 0.0008 | 0.0002 |\n| ujson | 0.0002 | 0.0011 | 0.0003 |\n| rapidjson | 0.0003 | 0.0015 | 0.0003 |\n| yyjson | 0.0003 | 0.0014 | 0.0003 |\n| cysimdjson | 0.0003 | 0.0009 | 0.0003 |\n| json | 0.0007 | 0.0019 | 0.0007 |\n\n\n### Merge Patch\n\n![](histograms/-Merge_Patch.svg 'Histogram for Merge Patch.')\n\n| library | min (ms) | max (ms) | mean (ms) |\n| ------- | -------- | -------- | --------- |\n| yyjson | 0.0004 | 0.0010 | 0.0004 |\n| json_merge_patch | 0.0004 | 0.0027 | 0.0005 |\n\n\n\u003c!-- end_performance_block --\u003e\n\n\n## FAQ\n\n### Why doesn't this run benchmarks using Github Actions?\n\nGenerally, unless you control the CI runners with self-hosted boxes (which are\nunsafe on public Github projects!), you have no idea what machine you're going\nto get, or how many *other* jobs may be running on the same machine. This can\ncause the benchmarks to vary drastically between runs, even minutes apart. For\nthis reason benchmarks are always run locally on a consistent machine, in a\nconsistent state.\n\n### What machine is used for the x64 benchmarks?\n\nx64 tests are run on an AMD Ryzen 7 5800X, capped at base clock speed with\n64GB of Corsair CMW32GX4M2E3200C16.\n\n### JSON is terrible, use X!\n\nThis repository isn't for arguing the pros or cons of JSON versus some other\nexchange format. You frequently have no choice but to work with JSON, and if\nyou can read or write responses 15% faster, that means you can handle more\nrequests per second with the same hardware.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftktech%2Fjson_benchmark","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftktech%2Fjson_benchmark","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftktech%2Fjson_benchmark/lists"}