# ssrJSON-benchmark
<div align="center">
[](https://pypi.org/project/ssrjson-benchmark/) [](https://pypi.org/project/ssrjson-benchmark/)
The [ssrJSON](https://github.com/Antares0982/ssrjson) benchmark repository.
</div>
## Benchmark Results
The benchmark results can be found in [website results](https://ikuyo.dev/ssrJSON-benchmark/) or [GitHub results](https://github.com/Nambers/ssrJSON-benchmark/tree/main/results). Contributing your benchmark result is welcomed.
Quick jump for
* [x86-64-v2, SSE4.2](https://github.com/Nambers/ssrJSON-benchmark/tree/main/results/SSE4.2)
* [x86-64-v3, AVX2](https://github.com/Nambers/ssrJSON-benchmark/tree/main/results/AVX2)
* [x86-64-v4, AVX512](https://github.com/Nambers/ssrJSON-benchmark/tree/main/results/AVX512)
## Usage
```bash
# you may need to install `svglib`, `reportlab` and `py-cpuinfo` as well
pip install ssrjson-benchmark
python -m ssrjson_benchmark
```
## Benchmark options
* `-m` output in Markdown instead of PDF.
* `-f <json_path>` used exists benchmark json result.
* `--process-bytes <bytes_num>` Total process bytes per test, default 1e8.
## Notes
* This repository conducts benchmarking using json, orjson, and ssrJSON. The `dumps` benchmark produces str objects, comparing three operations: `json.dumps`, `orjson.dumps` followed by decode, and `ssrjson.dumps`. The `dumps_to_bytes` benchmark produces bytes objects, comparing three functions: `json.dumps` followed by encode, `orjson.dumps`, and `ssrjson.dumps_to_bytes`.
* When orjson handles non-ASCII strings, if the cache of the `PyUnicodeObject`’s UTF-8 representation does not exist, it invokes the `PyUnicode_AsUTF8AndSize` function to obtain the UTF-8 encoding. This function then caches the UTF-8 representation within the `PyUnicodeObject`. If the same `PyUnicodeObject` undergoes repeated encode-decode operations, subsequent calls after the initial one will execute more quickly due to this caching. However, in real-world production scenarios, it is uncommon to perform JSON encode-decode repeatedly on the exact same string object; even identical strings are unlikely to be the same object instance. To achieve benchmark results that better reflect practical use cases, we employ `ssrjson.run_unicode_accumulate_benchmark` and `benchmark_invalidate_dump_cache` functions, which ensure that new `PyUnicodeObject`s are different for each input every time. (ref: [orjson#586](https://github.com/ijl/orjson/issues/586))
* The performance of JSON encoding is primarily constrained by the speed of writing to the buffer, whereas decoding performance is mainly limited by the frequent invocation of CPython interfaces for object creation. During decoding, both ssrJSON and orjson employ short key caching to reduce the number of object creations, and this caching mechanism is global in both cases. As a result, decoding benchmark tests may not accurately reflect the conditions encountered in real-world production environments.
* The files simple_object.json and simple_object_zh.json do not represent real-world data; they are solely used to compare the performance of the fast path. Therefore, the benchmark results should not be interpreted as indicative of actual performance.
Raw data
{
"_id": null,
"home_page": null,
"name": "ssrjson-benchmark",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "ssrjson, benchmark, json",
"author": null,
"author_email": "Eritque Arcus <eritque-arcus@ikuyo.dev>, Antares <antares0982@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/1f/28/0e90243a7dce6f9211497e4960b5cf02b4dd48f12af4bb94c5c8aae81848/ssrjson_benchmark-0.0.1rc2.tar.gz",
"platform": null,
"description": "# ssrJSON-benchmark\n\n<div align=\"center\">\n\n[](https://pypi.org/project/ssrjson-benchmark/) [](https://pypi.org/project/ssrjson-benchmark/)\n\nThe [ssrJSON](https://github.com/Antares0982/ssrjson) benchmark repository.\n\n</div>\n\n## Benchmark Results\n\nThe benchmark results can be found in [website results](https://ikuyo.dev/ssrJSON-benchmark/) or [GitHub results](https://github.com/Nambers/ssrJSON-benchmark/tree/main/results). Contributing your benchmark result is welcomed.\n\nQuick jump for\n\n* [x86-64-v2, SSE4.2](https://github.com/Nambers/ssrJSON-benchmark/tree/main/results/SSE4.2)\n* [x86-64-v3, AVX2](https://github.com/Nambers/ssrJSON-benchmark/tree/main/results/AVX2)\n* [x86-64-v4, AVX512](https://github.com/Nambers/ssrJSON-benchmark/tree/main/results/AVX512)\n\n## Usage\n\n```bash\n# you may need to install `svglib`, `reportlab` and `py-cpuinfo` as well\npip install ssrjson-benchmark\npython -m ssrjson_benchmark\n```\n\n## Benchmark options\n\n* `-m` output in Markdown instead of PDF.\n* `-f <json_path>` used exists benchmark json result.\n* `--process-bytes <bytes_num>` Total process bytes per test, default 1e8.\n\n## Notes\n\n* This repository conducts benchmarking using json, orjson, and ssrJSON. The `dumps` benchmark produces str objects, comparing three operations: `json.dumps`, `orjson.dumps` followed by decode, and `ssrjson.dumps`. The `dumps_to_bytes` benchmark produces bytes objects, comparing three functions: `json.dumps` followed by encode, `orjson.dumps`, and `ssrjson.dumps_to_bytes`.\n* When orjson handles non-ASCII strings, if the cache of the `PyUnicodeObject`\u2019s UTF-8 representation does not exist, it invokes the `PyUnicode_AsUTF8AndSize` function to obtain the UTF-8 encoding. This function then caches the UTF-8 representation within the `PyUnicodeObject`. If the same `PyUnicodeObject` undergoes repeated encode-decode operations, subsequent calls after the initial one will execute more quickly due to this caching. However, in real-world production scenarios, it is uncommon to perform JSON encode-decode repeatedly on the exact same string object; even identical strings are unlikely to be the same object instance. To achieve benchmark results that better reflect practical use cases, we employ `ssrjson.run_unicode_accumulate_benchmark` and `benchmark_invalidate_dump_cache` functions, which ensure that new `PyUnicodeObject`s are different for each input every time. (ref: [orjson#586](https://github.com/ijl/orjson/issues/586))\n* The performance of JSON encoding is primarily constrained by the speed of writing to the buffer, whereas decoding performance is mainly limited by the frequent invocation of CPython interfaces for object creation. During decoding, both ssrJSON and orjson employ short key caching to reduce the number of object creations, and this caching mechanism is global in both cases. As a result, decoding benchmark tests may not accurately reflect the conditions encountered in real-world production environments.\n* The files simple_object.json and simple_object_zh.json do not represent real-world data; they are solely used to compare the performance of the fast path. Therefore, the benchmark results should not be interpreted as indicative of actual performance.\n",
"bugtrack_url": null,
"license": null,
"summary": "benchmark of ssrJSON",
"version": "0.0.1rc2",
"project_urls": {
"Homepage": "https://github.com/Nambers/ssrJSON-benchmark",
"Issues": "https://github.com/Nambers/ssrJSON-benchmark/issues",
"Repository": "https://github.com/Nambers/ssrJSON-benchmark.git"
},
"split_keywords": [
"ssrjson",
" benchmark",
" json"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "d668aabdd594d525bdc93356bc85a2f4553ceb1254c1447f8c2b3af6ddca07f4",
"md5": "06ab1a844ff96e67770e289638f63302",
"sha256": "ae700c830be241d3c8c81c4c247aaa383d0923ae7ebfd62619a8b38e16ed2daf"
},
"downloads": -1,
"filename": "ssrjson_benchmark-0.0.1rc2-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl",
"has_sig": false,
"md5_digest": "06ab1a844ff96e67770e289638f63302",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": ">=3.9",
"size": 3138828,
"upload_time": "2025-08-07T22:29:31",
"upload_time_iso_8601": "2025-08-07T22:29:31.063466Z",
"url": "https://files.pythonhosted.org/packages/d6/68/aabdd594d525bdc93356bc85a2f4553ceb1254c1447f8c2b3af6ddca07f4/ssrjson_benchmark-0.0.1rc2-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "a5e2de29082ed75c393bb3aabe8464f00d05c27138cd9f010ca4232876df0853",
"md5": "53818b540a72ed22ee85471b34d28c94",
"sha256": "1e8b19adf319ede5fd5d18757730b088260ee44f58e93469ba209a7dccd223cf"
},
"downloads": -1,
"filename": "ssrjson_benchmark-0.0.1rc2-cp310-cp310-win_amd64.whl",
"has_sig": false,
"md5_digest": "53818b540a72ed22ee85471b34d28c94",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": ">=3.9",
"size": 3143153,
"upload_time": "2025-08-07T22:29:32",
"upload_time_iso_8601": "2025-08-07T22:29:32.951104Z",
"url": "https://files.pythonhosted.org/packages/a5/e2/de29082ed75c393bb3aabe8464f00d05c27138cd9f010ca4232876df0853/ssrjson_benchmark-0.0.1rc2-cp310-cp310-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "894e4c0969c7d931b9964f9efed6d053ef9033db53859c7d7ff0aa4ea628ff8b",
"md5": "99ae53c25132b85ddbe532931afdf874",
"sha256": "66fb70afb2d878fea97bcbea550ee790594077a348e9e3b6d501ad8f42cbcb68"
},
"downloads": -1,
"filename": "ssrjson_benchmark-0.0.1rc2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl",
"has_sig": false,
"md5_digest": "99ae53c25132b85ddbe532931afdf874",
"packagetype": "bdist_wheel",
"python_version": "cp311",
"requires_python": ">=3.9",
"size": 3138832,
"upload_time": "2025-08-07T22:29:35",
"upload_time_iso_8601": "2025-08-07T22:29:35.011584Z",
"url": "https://files.pythonhosted.org/packages/89/4e/4c0969c7d931b9964f9efed6d053ef9033db53859c7d7ff0aa4ea628ff8b/ssrjson_benchmark-0.0.1rc2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "016e9b53e5f2795822fd5afeb00d07f537e71848508a421d99d111d6e5331c25",
"md5": "aaac0e4208f6517295d7f4c270b9e8a4",
"sha256": "2ad1536a0d6afaa1893589d5e3b7095edad758c171b0467d86e712dfd330d315"
},
"downloads": -1,
"filename": "ssrjson_benchmark-0.0.1rc2-cp311-cp311-win_amd64.whl",
"has_sig": false,
"md5_digest": "aaac0e4208f6517295d7f4c270b9e8a4",
"packagetype": "bdist_wheel",
"python_version": "cp311",
"requires_python": ">=3.9",
"size": 3143155,
"upload_time": "2025-08-07T22:29:36",
"upload_time_iso_8601": "2025-08-07T22:29:36.832120Z",
"url": "https://files.pythonhosted.org/packages/01/6e/9b53e5f2795822fd5afeb00d07f537e71848508a421d99d111d6e5331c25/ssrjson_benchmark-0.0.1rc2-cp311-cp311-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "80fd81f461748aaf5b0f4a7da189c3dbf590a135ebaf977bf8fc7005b90ad83b",
"md5": "1920c4613239f355102fcd167f80ed0d",
"sha256": "1f1191b728598ee450b36dddf6c158a62a50cf016ecb13141175c43a47d2775d"
},
"downloads": -1,
"filename": "ssrjson_benchmark-0.0.1rc2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl",
"has_sig": false,
"md5_digest": "1920c4613239f355102fcd167f80ed0d",
"packagetype": "bdist_wheel",
"python_version": "cp312",
"requires_python": ">=3.9",
"size": 3138955,
"upload_time": "2025-08-07T22:29:38",
"upload_time_iso_8601": "2025-08-07T22:29:38.923288Z",
"url": "https://files.pythonhosted.org/packages/80/fd/81f461748aaf5b0f4a7da189c3dbf590a135ebaf977bf8fc7005b90ad83b/ssrjson_benchmark-0.0.1rc2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "bf359d176a5026fb67ddec282b92072252c268d333e562bb0aed19732a5396fb",
"md5": "dc784291c80f73aec458192aa82f2b86",
"sha256": "d7a9237597e2559737aa02ebb92f99cf7aa16c7331afebeddcd130284ce8a8af"
},
"downloads": -1,
"filename": "ssrjson_benchmark-0.0.1rc2-cp312-cp312-win_amd64.whl",
"has_sig": false,
"md5_digest": "dc784291c80f73aec458192aa82f2b86",
"packagetype": "bdist_wheel",
"python_version": "cp312",
"requires_python": ">=3.9",
"size": 3143194,
"upload_time": "2025-08-07T22:29:41",
"upload_time_iso_8601": "2025-08-07T22:29:41.067278Z",
"url": "https://files.pythonhosted.org/packages/bf/35/9d176a5026fb67ddec282b92072252c268d333e562bb0aed19732a5396fb/ssrjson_benchmark-0.0.1rc2-cp312-cp312-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "4681958332cb61b6231e21670ce7c377c26508c19ed01050913075f5b465629b",
"md5": "a01cf90241bb53cba8f4feffa1e032c3",
"sha256": "7f96604598fd68762a3e9c6257c3fb622d687dbde021a74ed4441384c408a1bb"
},
"downloads": -1,
"filename": "ssrjson_benchmark-0.0.1rc2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl",
"has_sig": false,
"md5_digest": "a01cf90241bb53cba8f4feffa1e032c3",
"packagetype": "bdist_wheel",
"python_version": "cp313",
"requires_python": ">=3.9",
"size": 3138952,
"upload_time": "2025-08-07T22:29:42",
"upload_time_iso_8601": "2025-08-07T22:29:42.486864Z",
"url": "https://files.pythonhosted.org/packages/46/81/958332cb61b6231e21670ce7c377c26508c19ed01050913075f5b465629b/ssrjson_benchmark-0.0.1rc2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "6f0e288685e8121780fd7f8109ed164ebfa8e3de1536f61ff66849edfb0e080d",
"md5": "914a2568f55c9686d90f34c86b1f0693",
"sha256": "2e13ad143fa5d9113624baadef02cdd3c560a12b4d3b3d0527bfc893a51da7ee"
},
"downloads": -1,
"filename": "ssrjson_benchmark-0.0.1rc2-cp313-cp313-win_amd64.whl",
"has_sig": false,
"md5_digest": "914a2568f55c9686d90f34c86b1f0693",
"packagetype": "bdist_wheel",
"python_version": "cp313",
"requires_python": ">=3.9",
"size": 3143189,
"upload_time": "2025-08-07T22:29:44",
"upload_time_iso_8601": "2025-08-07T22:29:44.286402Z",
"url": "https://files.pythonhosted.org/packages/6f/0e/288685e8121780fd7f8109ed164ebfa8e3de1536f61ff66849edfb0e080d/ssrjson_benchmark-0.0.1rc2-cp313-cp313-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "1303476e4d55188ffaa0d392eafecb7347453999460e16b198189e5bc7166857",
"md5": "ec50b307cb1ccb4eb082bab733efd653",
"sha256": "1cee3b6daa35afb35d252c826354c1db8e207cd483feeb3f77ba991f0a21e7fb"
},
"downloads": -1,
"filename": "ssrjson_benchmark-0.0.1rc2-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl",
"has_sig": false,
"md5_digest": "ec50b307cb1ccb4eb082bab733efd653",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 3138821,
"upload_time": "2025-08-07T22:29:46",
"upload_time_iso_8601": "2025-08-07T22:29:46.003369Z",
"url": "https://files.pythonhosted.org/packages/13/03/476e4d55188ffaa0d392eafecb7347453999460e16b198189e5bc7166857/ssrjson_benchmark-0.0.1rc2-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "6cb141d5d29fce2b5832de266d9a69a2c0f06f707b3dedb1786d2671daf2c38b",
"md5": "8a62481f7746edf6908d58537d22d14f",
"sha256": "5899d7fd3da2093dca2fde8b820307c96083e19c052977639397fe6cb929de3c"
},
"downloads": -1,
"filename": "ssrjson_benchmark-0.0.1rc2-cp39-cp39-win_amd64.whl",
"has_sig": false,
"md5_digest": "8a62481f7746edf6908d58537d22d14f",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 3143149,
"upload_time": "2025-08-07T22:29:47",
"upload_time_iso_8601": "2025-08-07T22:29:47.438449Z",
"url": "https://files.pythonhosted.org/packages/6c/b1/41d5d29fce2b5832de266d9a69a2c0f06f707b3dedb1786d2671daf2c38b/ssrjson_benchmark-0.0.1rc2-cp39-cp39-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "1f280e90243a7dce6f9211497e4960b5cf02b4dd48f12af4bb94c5c8aae81848",
"md5": "cac8b8e742e47eb869f5ab0af5e8cc9e",
"sha256": "54c1bd0c3e9980b3641b6a0629c9e08eebb2cefb358c6987adb929ca2e7eae9c"
},
"downloads": -1,
"filename": "ssrjson_benchmark-0.0.1rc2.tar.gz",
"has_sig": false,
"md5_digest": "cac8b8e742e47eb869f5ab0af5e8cc9e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 3079867,
"upload_time": "2025-08-07T22:29:49",
"upload_time_iso_8601": "2025-08-07T22:29:49.177105Z",
"url": "https://files.pythonhosted.org/packages/1f/28/0e90243a7dce6f9211497e4960b5cf02b4dd48f12af4bb94c5c8aae81848/ssrjson_benchmark-0.0.1rc2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-07 22:29:49",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Nambers",
"github_project": "ssrJSON-benchmark",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "matplotlib",
"specs": []
},
{
"name": "orjson",
"specs": []
},
{
"name": "reportlab",
"specs": []
},
{
"name": "svglib",
"specs": []
},
{
"name": "py-cpuinfo",
"specs": []
}
],
"lcname": "ssrjson-benchmark"
}