Skip to content

perf(readability): small performance improvements#4059

Open
jvoisin wants to merge 1 commit intominiflux:mainfrom
jvoisin:readabuilitty
Open

perf(readability): small performance improvements#4059
jvoisin wants to merge 1 commit intominiflux:mainfrom
jvoisin:readabuilitty

Conversation

@jvoisin
Copy link
Collaborator

@jvoisin jvoisin commented Feb 13, 2026

  • Don't create a string by concatenation on the heap to then pass it to a strings.Builder, pass everything, one by one, to it instead.
  • Lower the complexity of shouldRemoveCandidate from quadratic to linear.

- Don't create a string by concatenation on the heap to then pass it to a
  strings.Builder, pass everything, one by one, to it instead.
- Lower the complexity of shouldRemoveCandidate from quadratic to linear.
isFalsePositive := false
for _, maybeCandidateToRemove := range maybeCandidateToRemove {
if strings.Contains(str, maybeCandidateToRemove) {
isFalsePositive = true
Copy link
Member

Choose a reason for hiding this comment

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

@jvoisin you can break the loop the first time it's true

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.

2 participants