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

[chore][pkg/ottl] Use faster json parsing library #35130

Merged
merged 2 commits into from
Sep 19, 2024

Conversation

djaglowski
Copy link
Member

This follows #33785 by switching to a faster json library.

Copy link
Member

@crobert-1 crobert-1 left a comment

Choose a reason for hiding this comment

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

Suggestion: I don't think it's entirely necessary, but adding a changelog might be nice. Sharing that this is a performance enhancement is a plus, and it'd be slightly more easy to find this as a change to pkg/ottl if this ends up causing any unexpected bugs. Just a thought.

@atoulme
Copy link
Contributor

atoulme commented Sep 11, 2024

Any benchmarks?

@djaglowski
Copy link
Member Author

Any benchmarks?

I just added one using the same test file as #33785 but am seeing no meaningful change. Not sure how to explain it. I pushed it up in case someone else sees anything I'm missing.

@djaglowski
Copy link
Member Author

@BinaryFissionGames pointed out to me offline that the benchmark was just getting the function but not executing it.

Now I see a nice improvement:

benchstat pkg/ottl/old.txt pkg/ottl/new.txt                                                                                              ✭ ✱
goos: darwin
goarch: arm64
pkg: github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl/ottlfuncs
             │ pkg/ottl/old.txt │          pkg/ottl/new.txt           │
             │      sec/op      │   sec/op     vs base                │
ParseJSON-10        278.0µ ± 2%   246.3µ ± 3%  -11.38% (p=0.000 n=10)

             │ pkg/ottl/old.txt │           pkg/ottl/new.txt           │
             │       B/op       │     B/op      vs base                │
ParseJSON-10       26.84Ki ± 0%   10.89Ki ± 0%  -59.43% (p=0.000 n=10)

             │ pkg/ottl/old.txt │          pkg/ottl/new.txt          │
             │    allocs/op     │ allocs/op   vs base                │
ParseJSON-10         206.0 ± 0%   169.0 ± 1%  -17.96% (p=0.000 n=10)

@djaglowski djaglowski marked this pull request as ready for review September 11, 2024 14:51
@djaglowski djaglowski requested a review from a team September 11, 2024 14:51
Copy link
Member

@TylerHelmuth TylerHelmuth left a comment

Choose a reason for hiding this comment

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

@djaglowski please handle the merge conflicts

Copy link
Contributor

@codeboten codeboten left a comment

Choose a reason for hiding this comment

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

👍🏻

@codeboten codeboten merged commit 58c9d51 into open-telemetry:main Sep 19, 2024
155 of 156 checks passed
@github-actions github-actions bot added this to the next release milestone Sep 19, 2024
@djaglowski djaglowski deleted the ottl-faster-json branch September 20, 2024 13:01
jriguera pushed a commit to springernature/opentelemetry-collector-contrib that referenced this pull request Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants