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

Improve fast regexp matcher cache #482

Merged
merged 4 commits into from
Apr 17, 2023
Merged

Conversation

pracucci
Copy link
Collaborator

In #465 I've introduced an in-memory cache for FastRegexMatcher. Unfortunately we learned the hard way that a cache size limit based on the number of entries may practically cause unbounded memory utilization, based on the actual complexity of the cached regexps. Moreover, since there's no TTL, if a tenant runs many queries with complex regexps and then doesn't use regexps anymore (or they're used at a low rate), these cached entries will be never removed from the cache.

To solve these problems, in this PR I propose to:

  1. Limit the cache size by bytes (1GB limit)
  2. Add a 5m TTL to cached entries (we mostly care about hitting the cache for queries with recurring regexp matchers in a short time span)

To do it, I've introduced two more dependencies:

  1. github.com/DmitriyVTitov/size to compute the actual size of FastRegexMatcher
  2. github.com/dgraph-io/ristretto for the cache (instead of github.com/hashicorp/golang-lru/v2). I've picked ristretto because we already use such cache in GEM, so we have some experience with it

Benchmark

Ristretto is more complex (and so expensive) than the lightweight LRU I was using before, so the % CPU increase showed in the benchmark looks huge, but if you look at the actual time spent (ns) I think it's still acceptable.

name                                                                   old time/op    new time/op    delta
NewFastRegexMatcher/with_cache/#00-12                                    30.2ns ± 2%   147.8ns ± 1%  +390.05%  (p=0.000 n=3+3)
NewFastRegexMatcher/with_cache/foo-12                                    30.6ns ± 0%   196.1ns ± 1%  +540.53%  (p=0.000 n=3+3)
NewFastRegexMatcher/with_cache/^foo-12                                   31.6ns ± 0%   197.1ns ± 1%  +524.02%  (p=0.000 n=3+3)
NewFastRegexMatcher/with_cache/(foo|bar)-12                              31.6ns ± 0%   192.3ns ± 1%  +508.33%  (p=0.000 n=3+3)
NewFastRegexMatcher/with_cache/foo.*-12                                  32.4ns ± 1%   198.1ns ± 4%  +510.50%  (p=0.001 n=3+3)
NewFastRegexMatcher/with_cache/.*foo-12                                  35.6ns ± 1%   197.9ns ± 2%  +456.01%  (p=0.000 n=3+3)
NewFastRegexMatcher/with_cache/^.*foo$-12                                33.3ns ± 1%   198.1ns ± 2%  +495.73%  (p=0.000 n=3+3)
NewFastRegexMatcher/with_cache/^.+foo$-12                                36.2ns ± 0%   198.5ns ± 1%  +447.54%  (p=0.000 n=3+3)
NewFastRegexMatcher/with_cache/.*-12                                     36.5ns ± 4%   210.2ns ± 7%  +475.19%  (p=0.002 n=3+3)
NewFastRegexMatcher/with_cache/.+-12                                     36.1ns ± 0%   221.5ns ± 9%  +513.10%  (p=0.004 n=3+3)
NewFastRegexMatcher/with_cache/foo.+-12                                  35.1ns ± 1%   200.1ns ± 3%  +470.94%  (p=0.000 n=3+3)
NewFastRegexMatcher/with_cache/.+foo-12                                  37.6ns ± 4%   204.1ns ± 5%  +443.02%  (p=0.001 n=3+3)
NewFastRegexMatcher/with_cache/foo_.+-12                                 35.2ns ± 1%   197.5ns ± 1%  +460.44%  (p=0.000 n=3+3)
NewFastRegexMatcher/with_cache/foo_.*-12                                 35.2ns ± 2%   205.4ns ± 2%  +484.23%  (p=0.000 n=3+3)
NewFastRegexMatcher/with_cache/.*foo.*-12                                35.6ns ± 0%   206.6ns ± 1%  +480.72%  (p=0.000 n=3+3)
NewFastRegexMatcher/with_cache/.+foo.+-12                                34.4ns ± 1%   204.7ns ± 2%  +494.83%  (p=0.000 n=3+3)
NewFastRegexMatcher/with_cache/(?s:.*)-12                                35.3ns ± 1%   199.8ns ± 2%  +465.38%  (p=0.000 n=3+3)
NewFastRegexMatcher/with_cache/(?s:.+)-12                                35.9ns ± 2%   200.6ns ± 2%  +459.65%  (p=0.000 n=3+3)
NewFastRegexMatcher/with_cache/(?s:^.*foo$)-12                           36.4ns ± 1%   200.8ns ± 2%  +452.26%  (p=0.000 n=3+3)
NewFastRegexMatcher/with_cache/(?i:foo)-12                               35.2ns ± 2%   198.2ns ± 1%  +462.27%  (p=0.000 n=3+3)
NewFastRegexMatcher/with_cache/(?i:(foo|bar))-12                         36.0ns ± 5%   203.9ns ± 0%  +466.70%  (p=0.000 n=3+3)
NewFastRegexMatcher/with_cache/(?i:(foo1|foo2|bar))-12                   35.6ns ± 1%   206.8ns ± 1%  +480.39%  (p=0.000 n=3+3)
NewFastRegexMatcher/with_cache/^(?i:foo|oo)|(bar)$-12                    35.5ns ± 1%   203.7ns ± 1%  +474.00%  (p=0.000 n=3+3)
NewFastRegexMatcher/with_cache/(?i:(foo1|foo2|aaa|bbb|ccc|ddd|e-12       39.9ns ± 2%   217.1ns ± 1%  +444.35%  (p=0.000 n=3+3)
NewFastRegexMatcher/with_cache/((.*)(bar|b|buzz)(.+)|foo)$-12            36.8ns ± 1%   203.0ns ± 2%  +451.54%  (p=0.000 n=3+3)
NewFastRegexMatcher/with_cache/^$-12                                     36.2ns ± 2%   200.4ns ± 1%  +453.43%  (p=0.000 n=3+3)
NewFastRegexMatcher/with_cache/(prometheus|api_prom)_api_v1_.+-12        35.4ns ± 1%   202.3ns ± 0%  +471.46%  (p=0.000 n=3+3)
NewFastRegexMatcher/with_cache/10\.0\.(1|2)\.+-12                        35.7ns ± 1%   210.1ns ± 2%  +487.80%  (p=0.000 n=3+3)
NewFastRegexMatcher/with_cache/10\.0\.(1|2).+-12                         35.4ns ± 1%   206.0ns ± 1%  +481.65%  (p=0.000 n=3+3)
NewFastRegexMatcher/with_cache/((fo(bar))|.+foo)-12                      37.8ns ± 8%   207.8ns ± 1%  +449.31%  (p=0.000 n=3+3)
NewFastRegexMatcher/with_cache/zQPbMkNO|NNSPdvMi|iWuuSoAl|qbvKM-12       59.2ns ± 2%   314.8ns ± 1%  +432.15%  (p=0.000 n=3+3)
NewFastRegexMatcher/with_cache/jyyfj00j0061|jyyfj00j0062|jyyfj9-12       1.18µs ± 1%    3.92µs ± 5%  +233.75%  (p=0.001 n=3+3)
NewFastRegexMatcher/with_cache/(?i:(zQPbMkNO|NNSPdvMi|iWuuSoAl|-12       59.9ns ± 0%   316.2ns ± 1%  +427.79%  (p=0.000 n=3+3)
NewFastRegexMatcher/without_cache/#00-12                                 77.9ns ± 1%    85.7ns ± 1%   +10.01%  (p=0.001 n=3+3)
NewFastRegexMatcher/without_cache/foo-12                                  119ns ± 1%     122ns ± 0%    +3.06%  (p=0.003 n=3+3)
NewFastRegexMatcher/without_cache/^foo-12                                4.14µs ± 1%    4.19µs ± 0%      ~     (p=0.069 n=3+3)
NewFastRegexMatcher/without_cache/(foo|bar)-12                           6.54µs ± 1%    6.69µs ± 2%      ~     (p=0.096 n=3+3)
NewFastRegexMatcher/without_cache/foo.*-12                               5.08µs ± 1%    5.21µs ± 2%      ~     (p=0.178 n=3+3)
NewFastRegexMatcher/without_cache/.*foo-12                               4.70µs ± 1%    4.83µs ± 0%    +2.61%  (p=0.028 n=3+3)
NewFastRegexMatcher/without_cache/^.*foo$-12                             5.37µs ± 1%    5.53µs ± 0%      ~     (p=0.053 n=3+3)
NewFastRegexMatcher/without_cache/^.+foo$-12                             5.44µs ± 1%    5.61µs ± 0%    +3.09%  (p=0.007 n=3+3)
NewFastRegexMatcher/without_cache/.*-12                                  3.26µs ± 2%    3.29µs ± 1%      ~     (p=0.508 n=3+3)
NewFastRegexMatcher/without_cache/.+-12                                  3.08µs ± 0%    3.14µs ± 0%    +1.93%  (p=0.007 n=3+3)
NewFastRegexMatcher/without_cache/foo.+-12                               5.05µs ± 0%    5.16µs ± 0%    +2.23%  (p=0.001 n=3+3)
NewFastRegexMatcher/without_cache/.+foo-12                               4.89µs ± 2%    4.92µs ± 1%      ~     (p=0.728 n=3+3)
NewFastRegexMatcher/without_cache/foo_.+-12                              5.35µs ± 0%    5.46µs ± 0%    +2.08%  (p=0.004 n=3+3)
NewFastRegexMatcher/without_cache/foo_.*-12                              5.32µs ± 0%    5.43µs ± 0%    +2.22%  (p=0.000 n=3+3)
NewFastRegexMatcher/without_cache/.*foo.*-12                             5.49µs ± 1%    5.60µs ± 0%    +1.91%  (p=0.006 n=3+3)
NewFastRegexMatcher/without_cache/.+foo.+-12                             5.57µs ± 0%    5.79µs ± 3%      ~     (p=0.153 n=3+3)
NewFastRegexMatcher/without_cache/(?s:.*)-12                             3.42µs ± 1%    3.44µs ± 0%      ~     (p=0.484 n=3+3)
NewFastRegexMatcher/without_cache/(?s:.+)-12                             3.30µs ± 0%    3.32µs ± 0%      ~     (p=0.077 n=3+3)
NewFastRegexMatcher/without_cache/(?s:^.*foo$)-12                        5.56µs ± 0%    5.81µs ± 1%    +4.57%  (p=0.018 n=3+3)
NewFastRegexMatcher/without_cache/(?i:foo)-12                            4.23µs ± 0%    4.34µs ± 1%      ~     (p=0.077 n=3+3)
NewFastRegexMatcher/without_cache/(?i:(foo|bar))-12                      7.89µs ± 2%    8.01µs ± 0%      ~     (p=0.227 n=3+3)
NewFastRegexMatcher/without_cache/(?i:(foo1|foo2|bar))-12                10.1µs ± 1%    10.3µs ± 0%    +1.65%  (p=0.039 n=3+3)
NewFastRegexMatcher/without_cache/^(?i:foo|oo)|(bar)$-12                 10.6µs ± 1%    11.0µs ± 1%    +3.49%  (p=0.004 n=3+3)
NewFastRegexMatcher/without_cache/(?i:(foo1|foo2|aaa|bbb|ccc|ddd|e-12    44.0µs ± 2%    45.1µs ± 0%      ~     (p=0.116 n=3+3)
NewFastRegexMatcher/without_cache/((.*)(bar|b|buzz)(.+)|foo)$-12         13.9µs ± 2%    14.1µs ± 0%      ~     (p=0.379 n=3+3)
NewFastRegexMatcher/without_cache/^$-12                                  3.26µs ± 1%    3.34µs ± 0%    +2.38%  (p=0.010 n=3+3)
NewFastRegexMatcher/without_cache/(prometheus|api_prom)_api_v1_.+-12     14.7µs ± 0%    15.1µs ± 1%    +3.23%  (p=0.050 n=3+3)
NewFastRegexMatcher/without_cache/10\.0\.(1|2)\.+-12                     7.77µs ± 3%    7.51µs ± 0%      ~     (p=0.168 n=3+3)
NewFastRegexMatcher/without_cache/10\.0\.(1|2).+-12                      8.10µs ± 1%    8.16µs ± 0%      ~     (p=0.159 n=3+3)
NewFastRegexMatcher/without_cache/((fo(bar))|.+foo)-12                   9.65µs ± 0%    9.95µs ± 0%    +3.07%  (p=0.001 n=3+3)
NewFastRegexMatcher/without_cache/zQPbMkNO|NNSPdvMi|iWuuSoAl|qbvKM-12    6.97µs ± 1%    6.88µs ± 1%      ~     (p=0.066 n=3+3)
NewFastRegexMatcher/without_cache/jyyfj00j0061|jyyfj00j0062|jyyfj9-12     147µs ± 2%     147µs ± 1%      ~     (p=0.880 n=3+3)
NewFastRegexMatcher/without_cache/(?i:(zQPbMkNO|NNSPdvMi|iWuuSoAl|-12     254µs ± 0%     268µs ± 1%    +5.41%  (p=0.001 n=3+3)
NewFastRegexMatcher_CacheMisses/simple_regexp-12                          522ns ± 1%    1522ns ± 7%  +191.83%  (p=0.003 n=3+3)
NewFastRegexMatcher_CacheMisses/complex_regexp-12                        7.97µs ± 2%   33.93µs ± 1%  +325.52%  (p=0.000 n=3+3)

name                                                                   old alloc/op   new alloc/op   delta
NewFastRegexMatcher/with_cache/#00-12                                     0.00B          7.00B ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/foo-12                                     0.00B         23.00B ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/^foo-12                                    0.00B         23.00B ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/(foo|bar)-12                               0.00B         23.00B ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/foo.*-12                                   0.00B         23.00B ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/.*foo-12                                   0.00B         23.00B ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/^.*foo$-12                                 0.00B         23.00B ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/^.+foo$-12                                 0.00B         23.00B ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/.*-12                                      0.00B         23.00B ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/.+-12                                      0.00B         23.00B ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/foo.+-12                                   0.00B         23.00B ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/.+foo-12                                   0.00B         23.00B ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/foo_.+-12                                  0.00B         23.00B ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/foo_.*-12                                  0.00B         23.00B ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/.*foo.*-12                                 0.00B         23.00B ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/.+foo.+-12                                 0.00B         23.00B ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/(?s:.*)-12                                 0.00B         23.00B ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/(?s:.+)-12                                 0.00B         23.00B ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/(?s:^.*foo$)-12                            0.00B         23.00B ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/(?i:foo)-12                                0.00B         23.00B ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/(?i:(foo|bar))-12                          0.00B         23.00B ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/(?i:(foo1|foo2|bar))-12                    0.00B         23.00B ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/^(?i:foo|oo)|(bar)$-12                     0.00B         23.00B ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/(?i:(foo1|foo2|aaa|bbb|ccc|ddd|e-12        0.00B         23.00B ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/((.*)(bar|b|buzz)(.+)|foo)$-12             0.00B         23.00B ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/^$-12                                      0.00B         23.00B ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/(prometheus|api_prom)_api_v1_.+-12         0.00B         23.00B ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/10\.0\.(1|2)\.+-12                         0.00B         23.00B ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/10\.0\.(1|2).+-12                          0.00B         23.00B ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/((fo(bar))|.+foo)-12                       0.00B         23.00B ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/zQPbMkNO|NNSPdvMi|iWuuSoAl|qbvKM-12        0.00B         23.00B ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/jyyfj00j0061|jyyfj00j0062|jyyfj9-12        0.00B         24.00B ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/(?i:(zQPbMkNO|NNSPdvMi|iWuuSoAl|-12        0.00B         23.00B ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/#00-12                                   152B ± 0%      152B ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/foo-12                                   176B ± 0%      176B ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/^foo-12                                3.89kB ± 0%    3.89kB ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/(foo|bar)-12                           6.02kB ± 0%    6.02kB ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/foo.*-12                               5.06kB ± 0%    5.06kB ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/.*foo-12                               5.10kB ± 0%    5.10kB ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/^.*foo$-12                             5.84kB ± 0%    5.84kB ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/^.+foo$-12                             5.89kB ± 0%    5.89kB ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/.*-12                                  3.21kB ± 0%    3.21kB ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/.+-12                                  3.18kB ± 0%    3.18kB ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/foo.+-12                               5.06kB ± 0%    5.06kB ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/.+foo-12                               5.14kB ± 0%    5.14kB ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/foo_.+-12                              5.15kB ± 0%    5.15kB ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/foo_.*-12                              5.15kB ± 0%    5.15kB ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/.*foo.*-12                             5.89kB ± 0%    5.89kB ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/.+foo.+-12                             5.90kB ± 0%    5.90kB ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/(?s:.*)-12                             3.30kB ± 0%    3.30kB ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/(?s:.+)-12                             3.29kB ± 0%    3.29kB ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/(?s:^.*foo$)-12                        6.00kB ± 0%    6.00kB ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/(?i:foo)-12                            3.76kB ± 0%    3.76kB ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/(?i:(foo|bar))-12                      6.80kB ± 0%    6.80kB ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/(?i:(foo1|foo2|bar))-12                7.82kB ± 0%    7.82kB ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/^(?i:foo|oo)|(bar)$-12                 10.6kB ± 0%    10.6kB ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/(?i:(foo1|foo2|aaa|bbb|ccc|ddd|e-12    42.9kB ± 0%    42.9kB ± 0%      ~     (p=0.519 n=3+3)
NewFastRegexMatcher/without_cache/((.*)(bar|b|buzz)(.+)|foo)$-12         14.2kB ± 0%    14.2kB ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/^$-12                                  3.46kB ± 0%    3.46kB ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/(prometheus|api_prom)_api_v1_.+-12     14.7kB ± 0%    14.7kB ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/10\.0\.(1|2)\.+-12                     6.42kB ± 0%    6.42kB ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/10\.0\.(1|2).+-12                      6.80kB ± 0%    6.80kB ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/((fo(bar))|.+foo)-12                   10.0kB ± 0%    10.0kB ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/zQPbMkNO|NNSPdvMi|iWuuSoAl|qbvKM-12    4.85kB ± 0%    4.85kB ± 0%      ~     (p=0.184 n=3+3)
NewFastRegexMatcher/without_cache/jyyfj00j0061|jyyfj00j0062|jyyfj9-12    82.2kB ± 0%    82.2kB ± 0%      ~     (p=0.442 n=3+3)
NewFastRegexMatcher/without_cache/(?i:(zQPbMkNO|NNSPdvMi|iWuuSoAl|-12     276kB ± 0%     276kB ± 0%      ~     (p=0.113 n=3+3)
NewFastRegexMatcher_CacheMisses/simple_regexp-12                           255B ± 0%      696B ±18%  +173.30%  (p=0.021 n=3+3)
NewFastRegexMatcher_CacheMisses/complex_regexp-12                        6.06kB ± 0%   14.17kB ± 0%  +134.00%  (p=0.000 n=3+3)

name                                                                   old allocs/op  new allocs/op  delta
NewFastRegexMatcher/with_cache/#00-12                                      0.00           0.00           ~     (zero variance)
NewFastRegexMatcher/with_cache/foo-12                                      0.00           1.00 ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/^foo-12                                     0.00           1.00 ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/(foo|bar)-12                                0.00           1.00 ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/foo.*-12                                    0.00           1.00 ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/.*foo-12                                    0.00           1.00 ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/^.*foo$-12                                  0.00           1.00 ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/^.+foo$-12                                  0.00           1.00 ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/.*-12                                       0.00           1.00 ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/.+-12                                       0.00           1.00 ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/foo.+-12                                    0.00           1.00 ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/.+foo-12                                    0.00           1.00 ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/foo_.+-12                                   0.00           1.00 ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/foo_.*-12                                   0.00           1.00 ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/.*foo.*-12                                  0.00           1.00 ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/.+foo.+-12                                  0.00           1.00 ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/(?s:.*)-12                                  0.00           1.00 ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/(?s:.+)-12                                  0.00           1.00 ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/(?s:^.*foo$)-12                             0.00           1.00 ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/(?i:foo)-12                                 0.00           1.00 ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/(?i:(foo|bar))-12                           0.00           1.00 ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/(?i:(foo1|foo2|bar))-12                     0.00           1.00 ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/^(?i:foo|oo)|(bar)$-12                      0.00           1.00 ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/(?i:(foo1|foo2|aaa|bbb|ccc|ddd|e-12         0.00           1.00 ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/((.*)(bar|b|buzz)(.+)|foo)$-12              0.00           1.00 ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/^$-12                                       0.00           1.00 ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/(prometheus|api_prom)_api_v1_.+-12          0.00           1.00 ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/10\.0\.(1|2)\.+-12                          0.00           1.00 ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/10\.0\.(1|2).+-12                           0.00           1.00 ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/((fo(bar))|.+foo)-12                        0.00           1.00 ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/zQPbMkNO|NNSPdvMi|iWuuSoAl|qbvKM-12         0.00           1.00 ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/jyyfj00j0061|jyyfj00j0062|jyyfj9-12         0.00           1.00 ± 0%      ~     (zero variance)
NewFastRegexMatcher/with_cache/(?i:(zQPbMkNO|NNSPdvMi|iWuuSoAl|-12         0.00           1.00 ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/#00-12                                   2.00 ± 0%      2.00 ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/foo-12                                   3.00 ± 0%      3.00 ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/^foo-12                                  66.0 ± 0%      66.0 ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/(foo|bar)-12                             91.0 ± 0%      91.0 ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/foo.*-12                                 76.0 ± 0%      76.0 ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/.*foo-12                                 67.0 ± 0%      67.0 ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/^.*foo$-12                               74.0 ± 0%      74.0 ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/^.+foo$-12                               77.0 ± 0%      77.0 ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/.*-12                                    50.0 ± 0%      50.0 ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/.+-12                                    47.0 ± 0%      47.0 ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/foo.+-12                                 77.0 ± 0%      77.0 ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/.+foo-12                                 69.0 ± 0%      69.0 ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/foo_.+-12                                79.0 ± 0%      79.0 ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/foo_.*-12                                78.0 ± 0%      78.0 ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/.*foo.*-12                               74.0 ± 0%      74.0 ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/.+foo.+-12                               77.0 ± 0%      77.0 ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/(?s:.*)-12                               50.0 ± 0%      50.0 ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/(?s:.+)-12                               48.0 ± 0%      48.0 ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/(?s:^.*foo$)-12                          75.0 ± 0%      75.0 ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/(?i:foo)-12                              63.0 ± 0%      63.0 ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/(?i:(foo|bar))-12                         109 ± 0%       109 ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/(?i:(foo1|foo2|bar))-12                   139 ± 0%       139 ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/^(?i:foo|oo)|(bar)$-12                    137 ± 0%       137 ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/(?i:(foo1|foo2|aaa|bbb|ccc|ddd|e-12       433 ± 0%       433 ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/((.*)(bar|b|buzz)(.+)|foo)$-12            151 ± 0%       151 ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/^$-12                                    49.0 ± 0%      49.0 ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/(prometheus|api_prom)_api_v1_.+-12        182 ± 0%       182 ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/10\.0\.(1|2)\.+-12                       98.0 ± 0%      98.0 ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/10\.0\.(1|2).+-12                         111 ± 0%       111 ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/((fo(bar))|.+foo)-12                      116 ± 0%       116 ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/zQPbMkNO|NNSPdvMi|iWuuSoAl|qbvKM-12      7.00 ± 0%      7.00 ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/jyyfj00j0061|jyyfj00j0062|jyyfj9-12      6.00 ± 0%      6.00 ± 0%      ~     (zero variance)
NewFastRegexMatcher/without_cache/(?i:(zQPbMkNO|NNSPdvMi|iWuuSoAl|-12     1.50k ± 0%     1.50k ± 0%      ~     (zero variance)
NewFastRegexMatcher_CacheMisses/simple_regexp-12                           6.00 ± 0%      9.00 ± 0%      ~     (zero variance)
NewFastRegexMatcher_CacheMisses/complex_regexp-12                          10.0 ± 0%     133.0 ± 0%      ~     (zero variance)

Signed-off-by: Marco Pracucci <marco@pracucci.com>
Signed-off-by: Marco Pracucci <marco@pracucci.com>
@pracucci pracucci marked this pull request as ready for review April 17, 2023 11:08
Copy link
Contributor

@dimitarvdimitrov dimitarvdimitrov left a comment

Choose a reason for hiding this comment

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

LGTM

Signed-off-by: Marco Pracucci <marco@pracucci.com>
Signed-off-by: Marco Pracucci <marco@pracucci.com>
@pracucci pracucci merged commit c461e22 into main Apr 17, 2023
4 checks passed
@pracucci pracucci deleted the improve-fast-regexp-matcher-cache branch April 17, 2023 13:21
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.

None yet

2 participants