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

api: use jsoniter #7816

Merged
merged 1 commit into from
Oct 11, 2024
Merged

api: use jsoniter #7816

merged 1 commit into from
Oct 11, 2024

Conversation

GiedriusS
Copy link
Member

Use jsoniter for responding. Use Prometheus codecs for that. Benchmark:

goos: linux
goarch: amd64
pkg: github.com/thanos-io/thanos/pkg/api
cpu: Intel(R) Core(TM) i9-10885H CPU @ 2.40GHz
           │     old      │                newv2                 │
           │    sec/op    │    sec/op     vs base                │
Respond-16   1.497m ± 96%   1.208m ± 14%  -19.32% (p=0.000 n=10)

           │       old       │                newv2                 │
           │      B/op       │     B/op      vs base                │
Respond-16   1432.4Ki ± 227%   259.1Ki ± 1%  -81.91% (p=0.000 n=10)

           │     old     │               newv2                │
           │  allocs/op  │ allocs/op   vs base                │
Respond-16   30.000 ± 0%   8.000 ± 0%  -73.33% (p=0.000 n=10)
  • I added CHANGELOG entry for this change.
  • Change is not relevant to the end user.

Changes

Verification

@GiedriusS GiedriusS marked this pull request as ready for review October 11, 2024 13:35
Use jsoniter for responding. Use Prometheus codecs for that. Benchmark:

```
goos: linux
goarch: amd64
pkg: github.com/thanos-io/thanos/pkg/api
cpu: Intel(R) Core(TM) i9-10885H CPU @ 2.40GHz
           │     old      │                newv2                 │
           │    sec/op    │    sec/op     vs base                │
Respond-16   1.497m ± 96%   1.208m ± 14%  -19.32% (p=0.000 n=10)

           │       old       │                newv2                 │
           │      B/op       │     B/op      vs base                │
Respond-16   1432.4Ki ± 227%   259.1Ki ± 1%  -81.91% (p=0.000 n=10)

           │     old     │               newv2                │
           │  allocs/op  │ allocs/op   vs base                │
Respond-16   30.000 ± 0%   8.000 ± 0%  -73.33% (p=0.000 n=10)
```

Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@vinted.com>
Copy link
Contributor

@yeya24 yeya24 left a comment

Choose a reason for hiding this comment

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

Thanks!

@yeya24 yeya24 merged commit d215f5b into main Oct 11, 2024
21 of 22 checks passed
@yeya24 yeya24 deleted the use_jsoniter branch October 11, 2024 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants