{"id":19674692,"url":"https://github.com/cloudwego/gjson","last_synced_at":"2025-04-29T02:30:24.607Z","repository":{"id":257821389,"uuid":"869920643","full_name":"cloudwego/gjson","owner":"cloudwego","description":"Faster substitution of tidwall/gjson","archived":false,"fork":false,"pushed_at":"2024-10-10T02:39:45.000Z","size":530,"stargazers_count":34,"open_issues_count":0,"forks_count":1,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-05T12:33:11.578Z","etag":null,"topics":["json","simd"],"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/cloudwego.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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}},"created_at":"2024-10-09T06:11:19.000Z","updated_at":"2025-04-04T03:55:50.000Z","dependencies_parsed_at":"2024-10-11T07:54:56.170Z","dependency_job_id":"5a3c05a4-6363-4855-b8ec-092a918ce5ee","html_url":"https://github.com/cloudwego/gjson","commit_stats":null,"previous_names":["cloudwego/gjson"],"tags_count":1,"template":false,"template_full_name":"cloudwego/.github","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudwego%2Fgjson","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudwego%2Fgjson/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudwego%2Fgjson/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudwego%2Fgjson/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cloudwego","download_url":"https://codeload.github.com/cloudwego/gjson/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251420861,"owners_count":21586693,"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":["json","simd"],"created_at":"2024-11-11T17:19:26.361Z","updated_at":"2025-04-29T02:30:24.170Z","avatar_url":"https://github.com/cloudwego.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GJSON\n\nThis is a wrapper lib of [gjson](https://github.com/tidwall/gjson), which is accelerated by [sonic](https://github.com/bytedance/sonic)'s algorithm.\n\n## Performance\n\nIt's usually faster than original one, especially for large JSON. (see codes [here](testdata/gjson_timing_test.go))\n\n```\ngoversion: 1.22.0\ngoos: linux\ngoarch: amd64\ncpu: Intel(R) Xeon(R) Platinum 8260 CPU @ 2.40GHz\n                         │  origin.out   │             target.out              │\n                         │    sec/op     │   sec/op     vs base                │\nGetComplexPath/small-32     3.000µ ±  6%   2.591µ ± 6%  -13.65% (p=0.000 n=10)\nGetComplexPath/medium-32   24.855µ ±  5%   6.464µ ± 8%  -74.00% (p=0.000 n=10)\nGetComplexPath/large-32    1309.1µ ±  3%   270.0µ ± 8%  -79.37% (p=0.000 n=10)\nGetSimplePath/small-32      702.1n ± 11%   634.3n ± 5%   -9.66% (p=0.000 n=10)\nGetSimplePath/medium-32     9.558µ ±  3%   1.744µ ± 4%  -81.76% (p=0.000 n=10)\nGetSimplePath/Large-32     342.03µ ± 14%   37.83µ ± 5%  -88.94% (p=0.000 n=10)\ngeomean                     24.64µ         7.576µ       -69.26%\n\n                         │  origin.out  │             target.out              │\n                         │     B/op     │    B/op     vs base                 │\nGetComplexPath/small-32    104.0 ± 0%     104.0 ± 0%       ~ (p=1.000 n=10) ¹\nGetComplexPath/medium-32   16.00 ± 0%     16.00 ± 0%       ~ (p=1.000 n=10) ¹\nGetComplexPath/large-32    16.00 ± 0%     16.00 ± 0%       ~ (p=1.000 n=10) ¹\nGetSimplePath/small-32     0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹\nGetSimplePath/medium-32    0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹\nGetSimplePath/Large-32     0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹\ngeomean                               ²               +0.00%                ²\n¹ all samples are equal\n² summaries must be \u003e0 to compute geomean\n\n                         │  origin.out  │             target.out              │\n                         │  allocs/op   │ allocs/op   vs base                 │\nGetComplexPath/small-32    6.000 ± 0%     6.000 ± 0%       ~ (p=1.000 n=10) ¹\nGetComplexPath/medium-32   2.000 ± 0%     2.000 ± 0%       ~ (p=1.000 n=10) ¹\nGetComplexPath/large-32    2.000 ± 0%     2.000 ± 0%       ~ (p=1.000 n=10) ¹\nGetSimplePath/small-32     0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹\nGetSimplePath/medium-32    0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹\nGetSimplePath/Large-32     0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹\ngeomean                               ²               +0.00%       \n```\n\n## Options\n\n### FastPath\n\nThis option is used to cache parsed simple paths and search JSON path all-in-once in C funtions, to reduce the overhead of c-go interaction. By default, this option is disabled, because it will and consumes a little more memory than default. You can enable it by set environment variable `GJSON_FAST_PATH=1`.\n\n### FastString\n\nBy default, Gjson doesn't use the SIMD algorithm when decoding a string and does not validate UTF8 either, thus its string-value APIs' behaviors are slow and different from `encoding/json`. You can change the behaviors by setting the environment variable below:\n\n- `GJSON_FAST_STRING=1`: `SIMD-implemented` string parsing. The string-value APIs' behaviors will be the same as sonic/decoder's default behavior, with 2~3X times the speed of default string-parsing.\n- `GJSON_FAST_STRING=2`, `SIMD-implemented` string parsing, and UTF-8 validating. String-value APIs' behaviors will be totally same with `encoding/json.Decode` and also faster than the default.\n\n### Benchmark\n\nThis is a benchmark on the above options (see [codes](testdata/gjson_timing_test.go)):\n\n```\ngoversion: 1.22.0\ngoos: linux\ngoarch: amd64\npkg: github.com/tidwall/gjson/testdata\ncpu: Intel(R) Xeon(R) Platinum 8260 CPU @ 2.40GHz\nBenchmarkFastPath/normal/small-32                  741.1 ns/op        0 B/op        0 allocs/op\nBenchmarkFastPath/normal/medium-32                  1846 ns/op        0 B/op        0 allocs/op\nBenchmarkFastPath/normal/Large-32                  38675 ns/op        0 B/op        0 allocs/op\nBenchmarkFastPath/fast-path/small-32               364.4 ns/op        0 B/op        0 allocs/op\nBenchmarkFastPath/fast-path/medium-32               1662 ns/op        0 B/op        0 allocs/op\nBenchmarkFastPath/fast-path/Large-32               38976 ns/op        0 B/op        0 allocs/op\nBenchmarkParseString/normal/small-32               401.8 ns/op      192 B/op        2 allocs/op\nBenchmarkParseString/normal/medium-32               4600 ns/op     2560 B/op        2 allocs/op\nBenchmarkParseString/normal/large-32               63202 ns/op    27904 B/op        2 allocs/op\nBenchmarkParseString/fast-string/small-32          219.7 ns/op       96 B/op        1 allocs/op\nBenchmarkParseString/fast-string/medium-32          2076 ns/op     1408 B/op        1 allocs/op\nBenchmarkParseString/fast-string/large-32          15814 ns/op    14336 B/op        1 allocs/op\nBenchmarkParseString/validate-string/small-32      231.6 ns/op       96 B/op        1 allocs/op\nBenchmarkParseString/validate-string/medium-32      2116 ns/op     1408 B/op        1 allocs/op\nBenchmarkParseString/validate-string/large-32      16779 ns/op    14336 B/op        1 allocs/op\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudwego%2Fgjson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcloudwego%2Fgjson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudwego%2Fgjson/lists"}