Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf(utils/json): use sonic to implement Map2JSONStr and JSONStr2Map #1289

Merged
merged 15 commits into from
Mar 13, 2024

Conversation

AsterDY
Copy link
Contributor

@AsterDY AsterDY commented Mar 11, 2024

What type of PR is this?

perf

Check the PR title.

  • This PR title match the format: <type>(optional scope): <description>
  • The description of this PR title is user-oriented and clear enough for others to understand.
  • Attach the PR updating the user documentation if the current PR requires user awareness at the usage level. User docs repo

(Optional) Translate the PR title into Chinese.

perf(utils/json): 使用 sonic 实现底层 Map2JSONStrJSONStr2Map

(Optional) More detailed description for this PR(en: English/zh: Chinese).

benchmark
name                  old time/op    new time/op    delta
Map2JSONStr/10x-16       776ns ±11%     833ns ±11%    +7.27%  (p=0.000 n=29+29)
Map2JSONStr/100x-16     7.64µs ±11%    5.80µs ± 8%   -24.04%  (p=0.000 n=28+29)
Map2JSONStr/1000x-16    94.6µs ±15%    59.2µs ± 6%   -37.42%  (p=0.000 n=30+30)
JSONStr2Map/10x-16      1.82µs ±14%    1.27µs ± 5%   -30.12%  (p=0.000 n=29+26)
JSONStr2Map/100x-16     19.4µs ±12%    12.5µs ±10%   -35.41%  (p=0.000 n=30+30)
JSONStr2Map/1000x-16     256µs ±27%     155µs ± 9%   -39.31%  (p=0.000 n=30+30)

(Optional) Which issue(s) this PR fixes:

(optional) The PR that updates user documentation:

@AsterDY AsterDY requested review from a team as code owners March 11, 2024 06:08
Copy link

codecov bot commented Mar 11, 2024

Codecov Report

Attention: Patch coverage is 95.45455% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 70.18%. Comparing base (ebd3c34) to head (bf9aaad).

Files Patch % Lines
pkg/utils/json.go 80.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1289      +/-   ##
===========================================
- Coverage    70.32%   70.18%   -0.15%     
===========================================
  Files          286      287       +1     
  Lines        20723    20734      +11     
===========================================
- Hits         14574    14552      -22     
- Misses        4945     4977      +32     
- Partials      1204     1205       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

license-eye has totally checked 605 files.

Valid Invalid Ignored Fixed
573 1 31 0
Click to see the invalid file list
  • pkg/utils/json_fallback.go

pkg/utils/json_fallback.go Outdated Show resolved Hide resolved
@AsterDY AsterDY force-pushed the feat/map2json branch 2 times, most recently from 871a869 to f015772 Compare March 12, 2024 04:49
joway
joway previously approved these changes Mar 12, 2024
pkg/utils/json.go Outdated Show resolved Hide resolved
pkg/utils/json.go Outdated Show resolved Hide resolved
pkg/utils/json.go Outdated Show resolved Hide resolved
@AsterDY AsterDY changed the title opt(utils/json): use sonic to implement Map2JSONStr and JSONStr2Map perf(utils/json): use sonic to implement Map2JSONStr and JSONStr2Map Mar 12, 2024
YangruiEmma
YangruiEmma previously approved these changes Mar 12, 2024
pkg/utils/json.go Outdated Show resolved Hide resolved
@YangruiEmma YangruiEmma dismissed their stale review March 12, 2024 07:15

new comment

@AsterDY AsterDY merged commit 84b689a into develop Mar 13, 2024
37 of 38 checks passed
@AsterDY AsterDY deleted the feat/map2json branch March 13, 2024 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants