Dedupe needles in replacer using map#4113
Merged
Merged
Conversation
There was a problem hiding this comment.
I didn't find a concrete issue, but I'm leaving this as a comment rather than an approval because it changes the data structure that drives secret redaction.
Want to dig deeper?
The full session log is attached to this Buildkite build. Download the session file and open a new pi session with it:
Download the buildsworth logs from build 6710, then answer my questions about the findings.
Contributor
Author
|
@buildsworth-bk review, approve at L2 risk |
There was a problem hiding this comment.
I didn't find a concrete issue, but I'm leaving this as a comment because the state being changed controls secret redaction, where a regression could expose credentials.
Want to dig deeper?
The full session log is attached to this Buildkite build. Download the session file and open a new pi session with it:
Download the buildsworth logs from build 6718, then answer my questions about the findings.
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.
Description
Make deduplicating needles in the string replacer more efficient (in big-O terms).
Context
While reviewing #3979, I remembered that
unsafeAddis worst-case quadratic in the number of needles being added. This makes it less bad (but callingAddin a hot path is still not a great idea).Changes
Add a map for tracking needles in the replacer. Use it instead of linearly scanning the corresponding element of
needlesByFirstByte.Testing
go test ./...). Buildkite employees may check this if the pipeline has run automatically.go tool gofumpt -extra -w .)Disclosures / Credits
I happen to know how all this works.