Skip to content

Optimize string matching#6121

Merged
brancz merged 2 commits into
mainfrom
optimize-string-matching
Dec 18, 2025
Merged

Optimize string matching#6121
brancz merged 2 commits into
mainfrom
optimize-string-matching

Conversation

@brancz
Copy link
Copy Markdown
Member

@brancz brancz commented Dec 18, 2025

Improves performance by ~4x or more.

$ benchstat old.txt new.txt
goos: darwin
goarch: arm64
pkg: github.com/parca-dev/parca/pkg/query
cpu: Apple M1 Max
                                               │   old.txt    │               new.txt                │
                                               │    sec/op    │    sec/op     vs base                │
StringMatching/equalFoldBytes-10                 58.745n ± 1%   2.923n ±  7%  -95.02% (p=0.000 n=10)
StringMatching/containsFoldBytes-10               69.07n ± 7%   18.68n ±  3%  -72.95% (p=0.000 n=10)
StringMatching/hasPrefixFoldBytes-10              62.72n ± 2%   10.06n ± 13%  -83.96% (p=0.000 n=10)
StringMatchingLongStrings/containsFoldBytes-10   203.30n ± 2%   55.16n ±  2%  -72.87% (p=0.000 n=10)
geomean                                           84.81n        13.19n        -84.44%

@alwaysmeticulous
Copy link
Copy Markdown

alwaysmeticulous Bot commented Dec 18, 2025

✅ Meticulous spotted 0 visual differences across 338 screens tested: view results.

Meticulous evaluated ~4 hours of user flows against your PR.

Expected differences? Click here. Last updated for commit cdb3c82. This comment will update as new commits are pushed.

Improves performance by ~4x or more.

```
$ benchstat old.txt new.txt
goos: darwin
goarch: arm64
pkg: github.com/parca-dev/parca/pkg/query
cpu: Apple M1 Max
                                               │   old.txt    │               new.txt                │
                                               │    sec/op    │    sec/op     vs base                │
StringMatching/equalFoldBytes-10                 58.745n ± 1%   2.923n ±  7%  -95.02% (p=0.000 n=10)
StringMatching/containsFoldBytes-10               69.07n ± 7%   18.68n ±  3%  -72.95% (p=0.000 n=10)
StringMatching/hasPrefixFoldBytes-10              62.72n ± 2%   10.06n ± 13%  -83.96% (p=0.000 n=10)
StringMatchingLongStrings/containsFoldBytes-10   203.30n ± 2%   55.16n ±  2%  -72.87% (p=0.000 n=10)
geomean                                           84.81n        13.19n        -84.44%
```
Copy link
Copy Markdown
Contributor

@yomete yomete left a comment

Choose a reason for hiding this comment

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

lgtm

@brancz brancz merged commit 258efe0 into main Dec 18, 2025
38 checks passed
@brancz brancz deleted the optimize-string-matching branch December 18, 2025 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants