{"id":13786760,"url":"https://github.com/zerosnake0/go-json-benchmark","last_synced_at":"2026-01-27T13:41:15.283Z","repository":{"id":144280559,"uuid":"220759287","full_name":"zerosnake0/go-json-benchmark","owner":"zerosnake0","description":"Benchmark of Golang JSON Libraries","archived":false,"fork":false,"pushed_at":"2020-10-08T08:21:03.000Z","size":58,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-08-03T19:10:03.322Z","etag":null,"topics":["benchmark","djson","json","jsoniter","jzon","ugorji","ujson"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zerosnake0.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2019-11-10T08:00:15.000Z","updated_at":"2023-10-04T00:34:57.000Z","dependencies_parsed_at":"2024-01-05T21:46:14.912Z","dependency_job_id":"99370113-0342-4b43-93d0-2016930bab2d","html_url":"https://github.com/zerosnake0/go-json-benchmark","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerosnake0%2Fgo-json-benchmark","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerosnake0%2Fgo-json-benchmark/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerosnake0%2Fgo-json-benchmark/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerosnake0%2Fgo-json-benchmark/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zerosnake0","download_url":"https://codeload.github.com/zerosnake0/go-json-benchmark/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225105772,"owners_count":17421791,"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","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":["benchmark","djson","json","jsoniter","jzon","ugorji","ujson"],"created_at":"2024-08-03T19:01:34.316Z","updated_at":"2026-01-27T13:41:15.238Z","avatar_url":"https://github.com/zerosnake0.png","language":"Go","funding_links":[],"categories":["Benchmarks","Twitter","基准"],"sub_categories":["Other Software","其他软件"],"readme":"[![Mentioned in Awesome Go](https://awesome.re/mentioned-badge.svg)](https://github.com/avelino/awesome-go)\n[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit\u0026logoColor=white)](https://github.com/pre-commit/pre-commit)\n\n# Introduction\n\nThis is a benchmark for the json packages.\nYou are welcome to open an issue if you find anything wrong or out of date.\n\n# TL;DR\n\nIn conclusion, the `github.com/json-iterator/go` is your first choice,\nit provides you with lots of useful features, oo design and high performance.\n\n# How to run\n\n```shell\ngo test -v -bench ./...\n```\n\n# Example result\n\n```shell\nGOGC=off go test -bench=. -benchmem\n```\n\nThe result may vary according to the different environment.\nUse the result only as a reference.\n\n|     |     |     | ns/op | B/op | allocs/op |\n| --- | --- | --- | ----- | ---- | --------- |\n| 10Fields_Iterator_Object | jsoniter-readObjCB-8 | 1458022 | 810 | 144 | 14 |\n| 10Fields_Iterator_Object | jsoniter-readObj-8 | 1369156 | 813 | 144 | 14 |\n| 10Fields_Iterator_Object | jsonparser-8 | 1357131 | 908 | 80 | 4 |\n| 10Fields_Iterator_Object | jzon-readObj-8 | 1239000 | 955 | 144 | 14 |\n| 10Fields_Iterator_Object | jzon-readObjCB-8 | 1204593 | 991 | 144 | 14 |\n|     |     |     |       |      |           |\n| 10Fields_Unmarshal_Interface | djson-8 | 440643 | 2576 | 1174 | 27 |\n| 10Fields_Unmarshal_Interface | easyjson-8 | 422460 | 2894 | 1174 | 27 |\n| 10Fields_Unmarshal_Interface | jzon-8 | 414544 | 2904 | 1190 | 28 |\n| 10Fields_Unmarshal_Interface | jzon-fast-8 | 425950 | 2917 | 1190 | 28 |\n| 10Fields_Unmarshal_Interface | ujson-8 | 337881 | 3494 | 1494 | 38 |\n| 10Fields_Unmarshal_Interface | jsoniter-compatible-8 | 320720 | 3758 | 1350 | 38 |\n| 10Fields_Unmarshal_Interface | jsoniter-8 | 347126 | 4216 | 1350 | 38 |\n| 10Fields_Unmarshal_Interface | json-8 | 229218 | 5532 | 1414 | 36 |\n| 10Fields_Unmarshal_Interface | ugorji-8 | 212991 | 5608 | 2478 | 36 |\n|     |     |     |       |      |           |\n| 10Fields_Unmarshal_StructWithTag | jsoniter-8 | 1000000 | 1028 | 192 | 5 |\n| 10Fields_Unmarshal_StructWithTag | jsoniter-compatible-8 | 1223282 | 1034 | 192 | 5 |\n| 10Fields_Unmarshal_StructWithTag | jzon-8 | 1000000 | 1106 | 192 | 5 |\n| 10Fields_Unmarshal_StructWithTag | jzon-fast-8 | 1000000 | 1132 | 192 | 5 |\n| 10Fields_Unmarshal_StructWithTag | ugorji-8 | 476871 | 2705 | 1088 | 7 |\n| 10Fields_Unmarshal_StructWithTag | json-8 | 274917 | 4346 | 432 | 14 |\n|     |     |     |       |      |           |\n| 10Fields_Unmarshal_StructWoTag | jsoniter-compatible-8 | 887858 | 1406 | 256 | 15 |\n| 10Fields_Unmarshal_StructWoTag | jsoniter-8 | 872038 | 1451 | 256 | 15 |\n| 10Fields_Unmarshal_StructWoTag | jzon-8 | 694782 | 1607 | 192 | 5 |\n| 10Fields_Unmarshal_StructWoTag | json-8 | 242374 | 4879 | 432 | 14 |\n|     |     |     |       |      |           |\n| 10Fields_Valid | gjson-8 | 2991547 | 400 | 0 | 0 |\n| 10Fields_Valid | jzon-8 | 2099695 | 567 | 0 | 0 |\n| 10Fields_Valid | jsoniter-compatible-8 | 1583869 | 736 | 64 | 10 |\n| 10Fields_Valid | jsoniter-8 | 1628780 | 758 | 64 | 10 |\n| 10Fields_Valid | json-8 | 1000000 | 1114 | 0 | 0 |\n|     |     |     |       |      |           |\n| 20Fields_Unmarshal_Interface | jzon-fast-8 | 187482 | 6285 | 2732 | 53 |\n| 20Fields_Unmarshal_Interface | jzon-8 | 193900 | 6516 | 2731 | 53 |\n| 20Fields_Unmarshal_Interface | djson-8 | 238552 | 6606 | 2716 | 52 |\n| 20Fields_Unmarshal_Interface | easyjson-8 | 194299 | 6974 | 2716 | 52 |\n| 20Fields_Unmarshal_Interface | ujson-8 | 163780 | 7551 | 3340 | 73 |\n| 20Fields_Unmarshal_Interface | jsoniter-compatible-8 | 150829 | 7872 | 3051 | 73 |\n| 20Fields_Unmarshal_Interface | jsoniter-8 | 139962 | 8286 | 3051 | 73 |\n| 20Fields_Unmarshal_Interface | json-8 | 121875 | 10689 | 3003 | 67 |\n| 20Fields_Unmarshal_Interface | ugorji-8 | 119270 | 10768 | 4018 | 61 |\n|     |     |     |       |      |           |\n| 20Fields_Unmarshal_StructWithTag | jzon-8 | 512673 | 2345 | 368 | 9 |\n| 20Fields_Unmarshal_StructWithTag | jzon-fast-8 | 497636 | 2402 | 368 | 9 |\n| 20Fields_Unmarshal_StructWithTag | ugorji-8 | 484503 | 2532 | 1088 | 7 |\n| 20Fields_Unmarshal_StructWithTag | jsoniter-8 | 420992 | 2780 | 512 | 29 |\n| 20Fields_Unmarshal_StructWithTag | jsoniter-compatible-8 | 420163 | 2877 | 512 | 29 |\n| 20Fields_Unmarshal_StructWithTag | json-8 | 145645 | 8466 | 648 | 24 |\n|     |     |     |       |      |           |\n| 20Fields_Unmarshal_StructWoTag | jsoniter-compatible-8 | 425262 | 2724 | 512 | 29 |\n| 20Fields_Unmarshal_StructWoTag | jsoniter-8 | 435942 | 2758 | 512 | 29 |\n| 20Fields_Unmarshal_StructWoTag | jzon-8 | 251348 | 4908 | 1057 | 9 |\n| 20Fields_Unmarshal_StructWoTag | json-8 | 116900 | 9759 | 648 | 24 |\n|     |     |     |       |      |           |\n| 20Fields_Valid | gjson-8 | 1483011 | 776 | 0 | 0 |\n| 20Fields_Valid | jzon-8 | 1000000 | 1070 | 0 | 0 |\n| 20Fields_Valid | jsoniter-compatible-8 | 813631 | 1376 | 144 | 20 |\n| 20Fields_Valid | jsoniter-8 | 772488 | 1418 | 144 | 20 |\n| 20Fields_Valid | json-8 | 564940 | 2138 | 0 | 0 |\n|     |     |     |       |      |           |\n\n# TODO\n\n- add medium \u0026 large payload tests\n- auto benchmark\n\n# Packages tested\n\n## feature list\n\n| repo | version | unmarshal (interface) | unmarshal (struct) | iterator | valid |\n| -------------------------------------- | ------- | --------------- | --------------- | --- | --- |\n| encoding/json                          | 1.15.2  | x               | x               |     |  x  |\n| github.com/json-iterator/go            | 1.1.10  | x               | x               |  x  |  x  |\n| github.com/buger/jsonparser            | 1.0.0   |                 |                 |  x  |     |\n| github.com/a8m/djson                   | c02c5ae | x               |                 |     |     |\n| github.com/mailru/easyjson             | 0.7.6   | x               | \u003csup\u003e(1)\u003c/sup\u003e  |     |     |\n| github.com/mreiferson/go-ujson         | c02629f | x\u003csup\u003e(2)\u003c/sup\u003e |                 |     |     |\n| github.com/ugorji/go/codec             | 1.1.10  | x\u003csup\u003e(3)\u003c/sup\u003e | x\u003csup\u003e(4)\u003c/sup\u003e |     |     |\n| github.com/tidwall/gjson\u003csup\u003e(5)\u003c/sup\u003e | 1.6.1   |                 | \u003csup\u003e(6)\u003c/sup\u003e  |     |  x  |\n| github.com/zerosnake0/jzon             | 0.0.5   | x               | x               |  x  |  x  |\n\n### notes:\n1. easyjson use its own marshaler/unmarshaler, which is not tested\n2. ujson use ujson.numeric which is its internal type for numbers\n3. ugorji need to be configured in order to be compatible with standard library\n4. ugorji decode into structure:\n   - can decode into a structure with tag\n   - cannot decode into a structure without a tag unless all field names are as same as tag names\n   - use its own marshaler/unmarshaler (codec.Selfer) interface to decode structure\n5. gjson deprecated its unmarshal methods from `v1.4.0`\n6. gjson only decode into structure fields with tag (`\u003c= v1.3.6`)\n\n\n# The following packages are not tested\n\n| repo | reason |\n| ------------------------------- | ------------------------------------------ |\n| github.com/Jeffail/gabs         | the encoding/decoding uses `encoding/json` |\n| github.com/bitly/go-simplejson  | the encoding/decoding uses `encoding/json` |\n| github.com/antonholmquist/jason | the encoding/decoding uses `encoding/json` |\n| github.com/pquerna/ffjson       | the encoding/decoding uses `encoding/json` (if the custom interface is not provided) |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzerosnake0%2Fgo-json-benchmark","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzerosnake0%2Fgo-json-benchmark","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzerosnake0%2Fgo-json-benchmark/lists"}