{"id":20602301,"url":"https://github.com/json-iterator/go-benchmark","last_synced_at":"2025-04-15T01:53:56.072Z","repository":{"id":57482959,"uuid":"75358002","full_name":"json-iterator/go-benchmark","owner":"json-iterator","description":"benchmark the golang version","archived":false,"fork":false,"pushed_at":"2020-09-02T05:44:30.000Z","size":1009,"stargazers_count":46,"open_issues_count":3,"forks_count":20,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-15T01:53:41.078Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/json-iterator.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}},"created_at":"2016-12-02T03:43:01.000Z","updated_at":"2024-01-13T16:44:08.000Z","dependencies_parsed_at":"2022-09-03T09:51:30.408Z","dependency_job_id":null,"html_url":"https://github.com/json-iterator/go-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/json-iterator%2Fgo-benchmark","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/json-iterator%2Fgo-benchmark/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/json-iterator%2Fgo-benchmark/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/json-iterator%2Fgo-benchmark/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/json-iterator","download_url":"https://codeload.github.com/json-iterator/go-benchmark/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248991540,"owners_count":21194894,"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":[],"created_at":"2024-11-16T09:13:23.771Z","updated_at":"2025-04-15T01:53:56.049Z","avatar_url":"https://github.com/json-iterator.png","language":"Go","readme":"* jsonparser: https://github.com/buger/jsonparser\n* jsoniter pull-api: https://github.com/json-iterator/go\n* jsoniter reflect-api: https://github.com/json-iterator/go/blob/master/jsoniter_reflect.go\n* encoding/json: golang standard lib\n* easy json: https://github.com/mailru/easyjson\n\nThe goal is to prove jsoniter is not slow, not to prove it is the fastest, at least good enough.\nMy motivation of inventing json iterator is the flexibility to mix high level and low level api.\nPerformance is the by-product of schema based parsing.\n\n* CPU: i7-6700K @ 4.0G\n* Level 1 cache size: 4 x 32 KB 8-way set associative instruction caches\n* Level 2 cache size: 4 x 256 KB 4-way set associative caches\n* Level 3 cache size: 8 MB 16-way set associative shared cache\n* Go: 1.8beta1\n\n# small payload\n\nhttps://github.com/json-iterator/go-benchmark/blob/master/src/github.com/json-iterator/go-benchmark/benchmark_small_payload_test.go\n\n| jsonparser  | jsoniter pull-api | jsoniter reflect-api | encoding/json | easyjson    |\n| ---         | ---               | ---                  | ---           | ---         |\n| 599 ns/op   | 515 ns/op         | 684 ns/op            | 2453 ns/op    | 687 ns/op   |\n| 64 B/op     | 64 B/op           | 256 B/op             | 864 B/op      | 64 B/op     |\n| 2 allocs/op | 2 allocs/op       | 4 allocs/op          | 31 allocs/op  | 2 allocs/op |\n\npull-api is fast, and reflection-api is not slow either.\nencoding/json is not that slow on i7-6700K, but much slower on cpu with smaller cache.\n\n![small](/small.png)\n\n# medium payload\n\nhttps://github.com/json-iterator/go-benchmark/blob/master/src/github.com/json-iterator/go-benchmark/benchmark_medium_payload_test.go\n\n| jsonparser  | jsoniter pull-api | jsoniter reflect-api | encoding/json | easyjson    |\n| ---         | ---               | ---                  | ---           | ---         |\n| 5238 ns/op  | 4111 ns/op        | 4708 ns/op           | 24939 ns/op   | 7361 ns/op  |\n| 104 B/op    | 104 B/op          | 368 B/op             | 808 B/op      | 248 B/op    |\n| 4 allocs/op | 4 allocs/op       | 14 allocs/op         | 18 allocs/op  | 8 allocs/op |\n\nreflect-api even out-performed the hand written parser\n\n![medium](/medium.png)\n\n# large payload\n\nhttps://github.com/json-iterator/go-benchmark/blob/master/src/github.com/json-iterator/go-benchmark/benchmark_large_payload_test.go\n\n| jsonparser  | jsoniter pull-api | encoding/json |\n| ---         | ---               | ---           |\n| 38334 ns/op | 38463 ns/op       | 290778 ns/op  |\n| 0 B/op      | 0 B/op            | 2128 B/op     |\n| 0 allocs/op | 0 allocs/op       | 46 allocs/op  |\n\nThis is a pure counting usage. jsonparser is faster\n\n![large](/large.png)\n\n# large file\n\ntest file used: https://github.com/json-iterator/test-data/blob/master/large-file.json\n\n| jsonparser     | jsoniter pull-api | encoding/json    |\n| ---            | ---               | ---              |\n| 42698634 ns/op | 37760014 ns/op    | 235354502 ns/op  |\n| 67107104 B/op  | 4248 B/op         | 71467896 B/op    |\n| 19 allocs/op   | 5 allocs/op       | 272477 allocs/op |\n\nThe difference here is because jsonparser take []byte as input, but jsoniter can take io.Reader as input.\n\n![large-file](/large-file.png)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjson-iterator%2Fgo-benchmark","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjson-iterator%2Fgo-benchmark","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjson-iterator%2Fgo-benchmark/lists"}