bytedance / sonic

A blazingly fast JSON serializing & deserializing library
Apache License 2.0
6.8k stars 333 forks source link

feat:(ast) introduce `Value` to support concurrent operations #573

Closed AsterDY closed 8 months ago

AsterDY commented 8 months ago

Background

sonic/ast.Node provide completed and efficient APIs to manipulate JSON. However, due to its transversely-lazy-load design, it CANNOT be read concurrently, result in limited usage in practice -- or abuse usage of LoadAll(). Therefore, we consider introduce a new type ast.Value, whose APIs are all based on JSON skipping-and-searching algorithm, can naturally support concurrently read

Thread Safty

Performance

Value's performance is close to Node, and 3x~10x times faster than the same API of gjson|sjson!!!

codecov-commenter commented 8 months ago

Codecov Report

Attention: 575 lines in your changes are missing coverage. Please review.

Comparison is base (63f4c07) 78.57% compared to head (583741e) 77.60%.

Files Patch % Lines
ast/raw.go 65.05% 186 Missing and 103 partials :warning:
ast/parser.go 63.78% 93 Missing and 62 partials :warning:
ast/search.go 33.33% 45 Missing and 9 partials :warning:
ast/decode.go 0.00% 52 Missing :warning:
api.go 5.26% 18 Missing :warning:
ast/api_amd64.go 78.12% 4 Missing and 3 partials :warning:

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #573 +/- ## ========================================== - Coverage 78.57% 77.60% -0.98% ========================================== Files 69 70 +1 Lines 10823 11841 +1018 ========================================== + Hits 8504 9189 +685 - Misses 1942 2138 +196 - Partials 377 514 +137 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.