Repository navigation
datadog: add fast path for serializer - #213
Merged
Merged
Conversation
kevinburkesegment
force-pushed
the
benchmarks
branch
from
November 8, 2025 01:30
98f08b0 to
791dd09
Compare
Comment on lines
+272
to
+279
| // Trim leading/trailing '.', '_' or '-' | ||
| start, end := orig, len(dst) | ||
| for start < end && isTrim(dst[start]) { | ||
| start++ | ||
| } | ||
| for end > start && isTrim(dst[end-1]) { | ||
| end-- | ||
| } |
Contributor
There was a problem hiding this comment.
Why not just use strings.Trim or bytes.Trim for this?
Comment on lines
+577
to
+578
| b.ResetTimer() | ||
| for i := 0; i < b.N; i++ { |
Contributor
There was a problem hiding this comment.
Suggested change
| b.ResetTimer() | |
| for i := 0; i < b.N; i++ { | |
| for b.Loop() { |
b.Loop is the newer, improved way to do this since 1.24, and provides a b.ResetTimer for free ahead of the first iter. See https://pkg.go.dev/testing#B.Loop
Comment on lines
+605
to
+607
| cutset := "._-" | ||
| b.ResetTimer() | ||
| for i := 0; i < b.N; i++ { |
Contributor
There was a problem hiding this comment.
Suggested change
| cutset := "._-" | |
| b.ResetTimer() | |
| for i := 0; i < b.N; i++ { | |
| const cutset = "._-" | |
| for b.Loop() { |
In the common case where metric names/tags are all ASCII, we can copy bytes much more quickly. Update some unrelated code to fix some formatting concerns and also use the newest syntax.
kevinburkesegment
force-pushed
the
benchmarks
branch
from
November 22, 2025 05:16
acddb8d to
9fcd686
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In the common case where metric names/tags are all ASCII, we can copy bytes much more quickly.