An error occurred fetching the project authors.
  1. 12 Oct, 2018 4 commits
    • Russ Cox's avatar
      regexp: evaluate context flags lazily · 3ca1f28e
      Russ Cox authored
      There's no point in computing whether we're at the
      beginning of the line if the NFA isn't going to ask.
      Wait to compute that until asked.
      
      Whatever minor slowdowns were introduced by
      the conversion to pools that were not repaid by
      other optimizations are taken care of by this one.
      
      name                             old time/op    new time/op    delta
      Find-12                             252ns ± 0%     260ns ± 0%   +3.34%  (p=0.000 n=10+8)
      FindAllNoMatches-12                 136ns ± 4%     134ns ± 4%   -0.96%  (p=0.033 n=10+10)
      FindString-12                       246ns ± 0%     250ns ± 0%   +1.46%  (p=0.000 n=8+10)
      FindSubmatch-12                     332ns ± 1%     332ns ± 0%     ~     (p=0.101 n=9+10)
      FindStringSubmatch-12               321ns ± 1%     322ns ± 1%     ~     (p=0.717 n=9+10)
      Literal-12                         91.6ns ± 0%    92.3ns ± 0%   +0.74%  (p=0.000 n=9+9)
      NotLiteral-12                      1.47µs ± 0%    1.47µs ± 0%   +0.38%  (p=0.000 n=9+8)
      MatchClass-12                      2.15µs ± 0%    2.15µs ± 0%   +0.39%  (p=0.000 n=10+10)
      MatchClass_InRange-12              2.09µs ± 0%    2.11µs ± 0%   +0.75%  (p=0.000 n=9+9)
      ReplaceAll-12                      1.40µs ± 0%    1.40µs ± 0%     ~     (p=0.525 n=10+10)
      AnchoredLiteralShortNonMatch-12    83.5ns ± 0%    81.6ns ± 0%   -2.28%  (p=0.000 n=9+10)
      AnchoredLiteralLongNonMatch-12      101ns ± 0%      97ns ± 1%   -3.54%  (p=0.000 n=10+10)
      AnchoredShortMatch-12               131ns ± 0%     128ns ± 0%   -2.29%  (p=0.000 n=10+9)
      AnchoredLongMatch-12                268ns ± 1%     252ns ± 1%   -6.04%  (p=0.000 n=10+10)
      OnePassShortA-12                    614ns ± 0%     587ns ± 1%   -4.33%  (p=0.000 n=6+10)
      NotOnePassShortA-12                 552ns ± 0%     547ns ± 1%   -0.89%  (p=0.000 n=10+10)
      OnePassShortB-12                    494ns ± 0%     455ns ± 0%   -7.96%  (p=0.000 n=9+9)
      NotOnePassShortB-12                 411ns ± 0%     406ns ± 0%   -1.30%  (p=0.000 n=9+9)
      OnePassLongPrefix-12                109ns ± 0%     108ns ± 1%     ~     (p=0.064 n=8+9)
      OnePassLongNotPrefix-12             403ns ± 0%     349ns ± 0%  -13.30%  (p=0.000 n=9+8)
      MatchParallelShared-12             38.9ns ± 1%    37.9ns ± 1%   -2.65%  (p=0.000 n=10+8)
      MatchParallelCopied-12             39.2ns ± 1%    38.3ns ± 2%   -2.20%  (p=0.001 n=10+10)
      QuoteMetaAll-12                    94.5ns ± 0%    94.7ns ± 0%   +0.18%  (p=0.043 n=10+9)
      QuoteMetaNone-12                   52.7ns ± 0%    52.7ns ± 0%     ~     (all equal)
      Match/Easy0/32-12                  72.2ns ± 0%    71.9ns ± 0%   -0.38%  (p=0.009 n=8+10)
      Match/Easy0/1K-12                   296ns ± 1%     297ns ± 0%   +0.51%  (p=0.001 n=10+9)
      Match/Easy0/32K-12                 4.57µs ± 3%    4.61µs ± 2%     ~     (p=0.280 n=10+10)
      Match/Easy0/1M-12                   234µs ± 0%     234µs ± 0%     ~     (p=0.986 n=10+10)
      Match/Easy0/32M-12                 7.96ms ± 0%    7.98ms ± 0%   +0.22%  (p=0.010 n=10+9)
      Match/Easy0i/32-12                 1.09µs ± 0%    1.10µs ± 0%   +0.23%  (p=0.000 n=8+9)
      Match/Easy0i/1K-12                 31.7µs ± 0%    31.7µs ± 0%   +0.09%  (p=0.003 n=9+8)
      Match/Easy0i/32K-12                1.61ms ± 0%    1.27ms ± 1%  -21.03%  (p=0.000 n=8+10)
      Match/Easy0i/1M-12                 51.4ms ± 0%    40.4ms ± 0%  -21.29%  (p=0.000 n=8+8)
      Match/Easy0i/32M-12                 1.65s ± 0%     1.30s ± 1%  -21.22%  (p=0.000 n=9+9)
      Match/Easy1/32-12                  67.6ns ± 1%    67.2ns ± 0%     ~     (p=0.085 n=10+9)
      Match/Easy1/1K-12                   873ns ± 2%     880ns ± 0%   +0.78%  (p=0.006 n=9+7)
      Match/Easy1/32K-12                 39.7µs ± 1%    34.3µs ± 3%  -13.53%  (p=0.000 n=10+10)
      Match/Easy1/1M-12                  1.41ms ± 1%    1.19ms ± 3%  -15.48%  (p=0.000 n=10+10)
      Match/Easy1/32M-12                 44.9ms ± 1%    38.0ms ± 2%  -15.21%  (p=0.000 n=10+10)
      Match/Medium/32-12                 1.04µs ± 0%    1.03µs ± 0%   -0.57%  (p=0.000 n=9+9)
      Match/Medium/1K-12                 31.2µs ± 0%    31.4µs ± 1%   +0.61%  (p=0.000 n=8+10)
      Match/Medium/32K-12                1.45ms ± 1%    1.20ms ± 0%  -17.70%  (p=0.000 n=10+8)
      Match/Medium/1M-12                 46.4ms ± 0%    38.4ms ± 2%  -17.32%  (p=0.000 n=6+9)
      Match/Medium/32M-12                 1.49s ± 1%     1.24s ± 1%  -16.81%  (p=0.000 n=10+10)
      Match/Hard/32-12                   1.47µs ± 0%    1.47µs ± 0%   -0.31%  (p=0.000 n=9+10)
      Match/Hard/1K-12                   44.5µs ± 1%    44.4µs ± 0%     ~     (p=0.075 n=10+10)
      Match/Hard/32K-12                  2.09ms ± 0%    1.78ms ± 7%  -14.88%  (p=0.000 n=8+10)
      Match/Hard/1M-12                   67.8ms ± 5%    56.9ms ± 7%  -16.05%  (p=0.000 n=10+10)
      Match/Hard/32M-12                   2.17s ± 5%     1.84s ± 6%  -15.21%  (p=0.000 n=10+10)
      Match/Hard1/32-12                  7.89µs ± 0%    7.94µs ± 0%   +0.61%  (p=0.000 n=9+9)
      Match/Hard1/1K-12                   246µs ± 0%     245µs ± 0%   -0.30%  (p=0.010 n=9+10)
      Match/Hard1/32K-12                 8.93ms ± 0%    8.17ms ± 0%   -8.44%  (p=0.000 n=9+8)
      Match/Hard1/1M-12                   286ms ± 0%     269ms ± 9%   -5.66%  (p=0.028 n=9+10)
      Match/Hard1/32M-12                  9.16s ± 0%     8.61s ± 8%   -5.98%  (p=0.028 n=9+10)
      Match_onepass_regex/32-12           825ns ± 0%     712ns ± 0%  -13.75%  (p=0.000 n=8+8)
      Match_onepass_regex/1K-12          28.7µs ± 1%    19.8µs ± 0%  -30.99%  (p=0.000 n=9+8)
      Match_onepass_regex/32K-12          950µs ± 1%     628µs ± 0%  -33.83%  (p=0.000 n=9+8)
      Match_onepass_regex/1M-12          30.4ms ± 0%    20.1ms ± 0%  -33.74%  (p=0.000 n=9+8)
      Match_onepass_regex/32M-12          974ms ± 1%     646ms ± 0%  -33.73%  (p=0.000 n=9+8)
      CompileOnepass-12                  4.60µs ± 0%    4.59µs ± 0%     ~     (p=0.063 n=8+9)
      [Geo mean]                         23.1µs         21.3µs        -7.44%
      
      https://perf.golang.org/search?q=upload:20181004.4
      
      Change-Id: I47cdd09f6dcde1d7c317080e9b4df42c7d0a8d24
      Reviewed-on: https://go-review.googlesource.com/c/139782
      Run-TryBot: Russ Cox <rsc@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      3ca1f28e
    • Russ Cox's avatar
      regexp: use pools for NFA machines · a376435a
      Russ Cox authored
      Now the machine struct is only used for NFA execution.
      Use global pools to cache machines instead of per-Regexp lists.
      
      Also eliminate some tail calls in NFA execution, to pay for
      the added overhead of sync.Pool.
      
      name                             old time/op    new time/op    delta
      Find-12                             252ns ± 0%     252ns ± 0%     ~     (p=1.000 n=10+10)
      FindAllNoMatches-12                 134ns ± 1%     136ns ± 4%     ~     (p=0.443 n=9+10)
      FindString-12                       246ns ± 0%     246ns ± 0%   -0.16%  (p=0.046 n=10+8)
      FindSubmatch-12                     333ns ± 2%     332ns ± 1%     ~     (p=0.489 n=10+9)
      FindStringSubmatch-12               320ns ± 0%     321ns ± 1%   +0.55%  (p=0.005 n=10+9)
      Literal-12                         91.1ns ± 0%    91.6ns ± 0%   +0.55%  (p=0.000 n=10+9)
      NotLiteral-12                      1.45µs ± 0%    1.47µs ± 0%   +0.82%  (p=0.000 n=10+9)
      MatchClass-12                      2.19µs ± 0%    2.15µs ± 0%   -2.01%  (p=0.000 n=9+10)
      MatchClass_InRange-12              2.09µs ± 0%    2.09µs ± 0%     ~     (p=0.082 n=10+9)
      ReplaceAll-12                      1.39µs ± 0%    1.40µs ± 0%   +0.50%  (p=0.000 n=10+10)
      AnchoredLiteralShortNonMatch-12    82.4ns ± 0%    83.5ns ± 0%   +1.36%  (p=0.000 n=8+9)
      AnchoredLiteralLongNonMatch-12      106ns ± 1%     101ns ± 0%   -4.36%  (p=0.000 n=10+10)
      AnchoredShortMatch-12               130ns ± 0%     131ns ± 0%   +0.77%  (p=0.000 n=9+10)
      AnchoredLongMatch-12                272ns ± 0%     268ns ± 1%   -1.46%  (p=0.000 n=8+10)
      OnePassShortA-12                    615ns ± 0%     614ns ± 0%     ~     (p=0.094 n=10+6)
      NotOnePassShortA-12                 549ns ± 0%     552ns ± 0%   +0.52%  (p=0.000 n=9+10)
      OnePassShortB-12                    494ns ± 0%     494ns ± 0%     ~     (p=0.247 n=8+9)
      NotOnePassShortB-12                 412ns ± 1%     411ns ± 0%     ~     (p=0.625 n=10+9)
      OnePassLongPrefix-12                108ns ± 0%     109ns ± 0%   +0.93%  (p=0.000 n=10+8)
      OnePassLongNotPrefix-12             402ns ± 0%     403ns ± 0%   +0.14%  (p=0.041 n=8+9)
      MatchParallelShared-12             38.6ns ± 2%    38.9ns ± 1%     ~     (p=0.172 n=9+10)
      MatchParallelCopied-12             39.4ns ± 7%    39.2ns ± 1%     ~     (p=0.423 n=10+10)
      QuoteMetaAll-12                    94.9ns ± 0%    94.5ns ± 0%   -0.42%  (p=0.000 n=9+10)
      QuoteMetaNone-12                   52.7ns ± 0%    52.7ns ± 0%     ~     (all equal)
      Match/Easy0/32-12                  72.1ns ± 0%    72.2ns ± 0%     ~     (p=0.435 n=9+8)
      Match/Easy0/1K-12                   298ns ± 0%     296ns ± 1%   -1.01%  (p=0.000 n=8+10)
      Match/Easy0/32K-12                 4.64µs ± 1%    4.57µs ± 3%   -1.39%  (p=0.030 n=10+10)
      Match/Easy0/1M-12                   234µs ± 0%     234µs ± 0%     ~     (p=0.971 n=10+10)
      Match/Easy0/32M-12                 7.95ms ± 0%    7.96ms ± 0%     ~     (p=0.278 n=9+10)
      Match/Easy0i/32-12                 1.10µs ± 0%    1.09µs ± 0%   -0.29%  (p=0.000 n=9+8)
      Match/Easy0i/1K-12                 31.8µs ± 1%    31.7µs ± 0%     ~     (p=0.704 n=10+9)
      Match/Easy0i/32K-12                1.62ms ± 1%    1.61ms ± 0%   -1.12%  (p=0.000 n=10+8)
      Match/Easy0i/1M-12                 51.8ms ± 0%    51.4ms ± 0%   -0.84%  (p=0.000 n=8+8)
      Match/Easy0i/32M-12                 1.65s ± 0%     1.65s ± 0%   -0.46%  (p=0.000 n=9+9)
      Match/Easy1/32-12                  67.7ns ± 1%    67.6ns ± 1%     ~     (p=0.723 n=10+10)
      Match/Easy1/1K-12                   873ns ± 0%     873ns ± 2%     ~     (p=0.345 n=10+9)
      Match/Easy1/32K-12                 39.4µs ± 0%    39.7µs ± 1%   +0.66%  (p=0.000 n=10+10)
      Match/Easy1/1M-12                  1.39ms ± 0%    1.41ms ± 1%   +1.10%  (p=0.000 n=10+10)
      Match/Easy1/32M-12                 44.3ms ± 0%    44.9ms ± 1%   +1.18%  (p=0.000 n=10+10)
      Match/Medium/32-12                 1.04µs ± 0%    1.04µs ± 0%   -0.58%  (p=0.000 n=9+9)
      Match/Medium/1K-12                 31.4µs ± 0%    31.2µs ± 0%   -0.62%  (p=0.000 n=8+8)
      Match/Medium/32K-12                1.45ms ± 0%    1.45ms ± 1%     ~     (p=0.356 n=9+10)
      Match/Medium/1M-12                 46.4ms ± 0%    46.4ms ± 0%     ~     (p=0.142 n=8+6)
      Match/Medium/32M-12                 1.49s ± 1%     1.49s ± 1%     ~     (p=0.739 n=10+10)
      Match/Hard/32-12                   1.48µs ± 0%    1.47µs ± 0%   -0.53%  (p=0.000 n=9+9)
      Match/Hard/1K-12                   45.0µs ± 1%    44.5µs ± 1%   -1.06%  (p=0.000 n=10+10)
      Match/Hard/32K-12                  2.24ms ± 0%    2.09ms ± 0%   -6.56%  (p=0.000 n=8+8)
      Match/Hard/1M-12                   71.6ms ± 0%    67.8ms ± 5%   -5.36%  (p=0.000 n=7+10)
      Match/Hard/32M-12                   2.29s ± 0%     2.17s ± 5%   -5.40%  (p=0.000 n=9+10)
      Match/Hard1/32-12                  7.89µs ± 0%    7.89µs ± 0%     ~     (p=0.053 n=9+9)
      Match/Hard1/1K-12                   244µs ± 0%     246µs ± 0%   +0.71%  (p=0.000 n=10+9)
      Match/Hard1/32K-12                 10.3ms ± 0%     8.9ms ± 0%  -13.76%  (p=0.000 n=10+9)
      Match/Hard1/1M-12                   331ms ± 0%     286ms ± 0%  -13.72%  (p=0.000 n=9+9)
      Match/Hard1/32M-12                  10.6s ± 0%      9.2s ± 0%  -13.72%  (p=0.000 n=10+9)
      Match_onepass_regex/32-12           830ns ± 0%     825ns ± 0%   -0.57%  (p=0.000 n=9+8)
      Match_onepass_regex/1K-12          28.7µs ± 1%    28.7µs ± 1%   -0.22%  (p=0.040 n=9+9)
      Match_onepass_regex/32K-12          949µs ± 0%     950µs ± 1%     ~     (p=0.236 n=8+9)
      Match_onepass_regex/1M-12          30.4ms ± 0%    30.4ms ± 0%     ~     (p=0.059 n=8+9)
      Match_onepass_regex/32M-12          973ms ± 0%     974ms ± 1%     ~     (p=0.258 n=9+9)
      CompileOnepass-12                  4.64µs ± 0%    4.60µs ± 0%   -0.90%  (p=0.000 n=10+8)
      [Geo mean]                         23.3µs         23.1µs        -1.16%
      
      https://perf.golang.org/search?q=upload:20181004.3
      
      Change-Id: I46f3d52ce89c8cd992cf554473c27af81fd81bfd
      Reviewed-on: https://go-review.googlesource.com/c/139781
      Run-TryBot: Russ Cox <rsc@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      a376435a
    • Russ Cox's avatar
      regexp: split one-pass execution out of machine struct · 60b29711
      Russ Cox authored
      This allows the one-pass executions to have their
      own pool of (much smaller) allocated structures.
      A step toward eliminating the per-Regexp machine cache.
      
      Not much effect on benchmarks, since there are no
      optimizations here, and pools are a tiny bit slower than a
      locked data structure for single-threaded code.
      
      name                             old time/op    new time/op    delta
      Find-12                             254ns ± 0%     252ns ± 0%  -0.94%  (p=0.000 n=9+10)
      FindAllNoMatches-12                 135ns ± 0%     134ns ± 1%  -0.49%  (p=0.002 n=9+9)
      FindString-12                       247ns ± 0%     246ns ± 0%  -0.24%  (p=0.003 n=8+10)
      FindSubmatch-12                     334ns ± 0%     333ns ± 2%    ~     (p=0.283 n=10+10)
      FindStringSubmatch-12               321ns ± 0%     320ns ± 0%  -0.51%  (p=0.000 n=9+10)
      Literal-12                         92.2ns ± 0%    91.1ns ± 0%  -1.25%  (p=0.000 n=9+10)
      NotLiteral-12                      1.47µs ± 0%    1.45µs ± 0%  -0.99%  (p=0.000 n=9+10)
      MatchClass-12                      2.17µs ± 0%    2.19µs ± 0%  +0.84%  (p=0.000 n=7+9)
      MatchClass_InRange-12              2.13µs ± 0%    2.09µs ± 0%  -1.70%  (p=0.000 n=10+10)
      ReplaceAll-12                      1.39µs ± 0%    1.39µs ± 0%  +0.51%  (p=0.000 n=10+10)
      AnchoredLiteralShortNonMatch-12    83.2ns ± 0%    82.4ns ± 0%  -0.96%  (p=0.000 n=8+8)
      AnchoredLiteralLongNonMatch-12      105ns ± 0%     106ns ± 1%    ~     (p=0.087 n=10+10)
      AnchoredShortMatch-12               131ns ± 0%     130ns ± 0%  -0.76%  (p=0.000 n=10+9)
      AnchoredLongMatch-12                267ns ± 0%     272ns ± 0%  +2.01%  (p=0.000 n=10+8)
      OnePassShortA-12                    611ns ± 0%     615ns ± 0%  +0.61%  (p=0.000 n=9+10)
      NotOnePassShortA-12                 552ns ± 0%     549ns ± 0%  -0.46%  (p=0.000 n=8+9)
      OnePassShortB-12                    491ns ± 0%     494ns ± 0%  +0.61%  (p=0.000 n=8+8)
      NotOnePassShortB-12                 412ns ± 0%     412ns ± 1%    ~     (p=0.151 n=9+10)
      OnePassLongPrefix-12                112ns ± 0%     108ns ± 0%  -3.57%  (p=0.000 n=10+10)
      OnePassLongNotPrefix-12             410ns ± 0%     402ns ± 0%  -1.95%  (p=0.000 n=9+8)
      MatchParallelShared-12             38.8ns ± 1%    38.6ns ± 2%    ~     (p=0.536 n=10+9)
      MatchParallelCopied-12             39.2ns ± 3%    39.4ns ± 7%    ~     (p=0.986 n=10+10)
      QuoteMetaAll-12                    94.6ns ± 0%    94.9ns ± 0%  +0.29%  (p=0.001 n=8+9)
      QuoteMetaNone-12                   52.7ns ± 0%    52.7ns ± 0%    ~     (all equal)
      Match/Easy0/32-12                  72.9ns ± 0%    72.1ns ± 0%  -1.07%  (p=0.000 n=9+9)
      Match/Easy0/1K-12                   298ns ± 0%     298ns ± 0%    ~     (p=0.140 n=6+8)
      Match/Easy0/32K-12                 4.60µs ± 2%    4.64µs ± 1%    ~     (p=0.171 n=10+10)
      Match/Easy0/1M-12                   235µs ± 0%     234µs ± 0%  -0.14%  (p=0.004 n=10+10)
      Match/Easy0/32M-12                 7.96ms ± 0%    7.95ms ± 0%  -0.12%  (p=0.043 n=10+9)
      Match/Easy0i/32-12                 1.09µs ± 0%    1.10µs ± 0%  +0.15%  (p=0.000 n=8+9)
      Match/Easy0i/1K-12                 31.7µs ± 0%    31.8µs ± 1%    ~     (p=0.905 n=9+10)
      Match/Easy0i/32K-12                1.61ms ± 0%    1.62ms ± 1%  +1.12%  (p=0.000 n=9+10)
      Match/Easy0i/1M-12                 51.4ms ± 0%    51.8ms ± 0%  +0.85%  (p=0.000 n=8+8)
      Match/Easy0i/32M-12                 1.65s ± 1%     1.65s ± 0%    ~     (p=0.113 n=9+9)
      Match/Easy1/32-12                  67.9ns ± 0%    67.7ns ± 1%    ~     (p=0.232 n=8+10)
      Match/Easy1/1K-12                   884ns ± 0%     873ns ± 0%  -1.29%  (p=0.000 n=9+10)
      Match/Easy1/32K-12                 39.2µs ± 0%    39.4µs ± 0%  +0.50%  (p=0.000 n=9+10)
      Match/Easy1/1M-12                  1.39ms ± 0%    1.39ms ± 0%  +0.29%  (p=0.000 n=9+10)
      Match/Easy1/32M-12                 44.2ms ± 1%    44.3ms ± 0%  +0.21%  (p=0.029 n=10+10)
      Match/Medium/32-12                 1.05µs ± 0%    1.04µs ± 0%  -0.27%  (p=0.001 n=8+9)
      Match/Medium/1K-12                 31.3µs ± 0%    31.4µs ± 0%  +0.39%  (p=0.000 n=9+8)
      Match/Medium/32K-12                1.45ms ± 0%    1.45ms ± 0%  +0.33%  (p=0.000 n=8+9)
      Match/Medium/1M-12                 46.2ms ± 0%    46.4ms ± 0%  +0.35%  (p=0.000 n=9+8)
      Match/Medium/32M-12                 1.48s ± 0%     1.49s ± 1%  +0.70%  (p=0.000 n=8+10)
      Match/Hard/32-12                   1.49µs ± 0%    1.48µs ± 0%  -0.43%  (p=0.000 n=10+9)
      Match/Hard/1K-12                   45.1µs ± 1%    45.0µs ± 1%    ~     (p=0.393 n=10+10)
      Match/Hard/32K-12                  2.18ms ± 1%    2.24ms ± 0%  +2.71%  (p=0.000 n=9+8)
      Match/Hard/1M-12                   69.7ms ± 1%    71.6ms ± 0%  +2.76%  (p=0.000 n=9+7)
      Match/Hard/32M-12                   2.23s ± 1%     2.29s ± 0%  +2.65%  (p=0.000 n=9+9)
      Match/Hard1/32-12                  7.89µs ± 0%    7.89µs ± 0%    ~     (p=0.286 n=9+9)
      Match/Hard1/1K-12                   244µs ± 0%     244µs ± 0%    ~     (p=0.905 n=9+10)
      Match/Hard1/32K-12                 10.3ms ± 0%    10.3ms ± 0%    ~     (p=0.796 n=10+10)
      Match/Hard1/1M-12                   331ms ± 0%     331ms ± 0%    ~     (p=0.167 n=8+9)
      Match/Hard1/32M-12                  10.6s ± 0%     10.6s ± 0%    ~     (p=0.315 n=8+10)
      Match_onepass_regex/32-12           812ns ± 0%     830ns ± 0%  +2.19%  (p=0.000 n=10+9)
      Match_onepass_regex/1K-12          28.5µs ± 0%    28.7µs ± 1%  +0.97%  (p=0.000 n=10+9)
      Match_onepass_regex/32K-12          936µs ± 0%     949µs ± 0%  +1.43%  (p=0.000 n=10+8)
      Match_onepass_regex/1M-12          30.2ms ± 0%    30.4ms ± 0%  +0.62%  (p=0.000 n=10+8)
      Match_onepass_regex/32M-12          970ms ± 0%     973ms ± 0%  +0.35%  (p=0.000 n=10+9)
      CompileOnepass-12                  4.63µs ± 1%    4.64µs ± 0%    ~     (p=0.060 n=10+10)
      [Geo mean]                         23.3µs         23.3µs       +0.12%
      
      https://perf.golang.org/search?q=upload:20181004.2
      
      Change-Id: Iff9e9f9d4a4698162126a2f300e8ed1b1a39361e
      Reviewed-on: https://go-review.googlesource.com/c/139780
      Run-TryBot: Russ Cox <rsc@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      60b29711
    • Russ Cox's avatar
      regexp: split bit-state execution out of machine struct · 2d4346b3
      Russ Cox authored
      This allows the bit-state executions to have their
      own pool of allocated structures. A step toward
      eliminating the per-Regexp machine cache.
      
      Note especially the -92% on MatchParallelShared.
      This is real but not a complete story: the other
      execution engines still need to be de-shared,
      but the benchmark was only using bit-state.
      
      The tiny slowdowns in unrelated code are noise.
      
      name                             old time/op    new time/op    delta
      Find-12                             264ns ± 3%     254ns ± 0%   -3.86%  (p=0.000 n=10+9)
      FindAllNoMatches-12                 140ns ± 2%     135ns ± 0%   -3.91%  (p=0.000 n=10+9)
      FindString-12                       256ns ± 0%     247ns ± 0%   -3.52%  (p=0.000 n=8+8)
      FindSubmatch-12                     339ns ± 1%     334ns ± 0%   -1.41%  (p=0.000 n=9+10)
      FindStringSubmatch-12               322ns ± 0%     321ns ± 0%   -0.21%  (p=0.005 n=8+9)
      Literal-12                          100ns ± 2%      92ns ± 0%   -8.10%  (p=0.000 n=10+9)
      NotLiteral-12                      1.50µs ± 0%    1.47µs ± 0%   -1.91%  (p=0.000 n=8+9)
      MatchClass-12                      2.18µs ± 0%    2.17µs ± 0%   -0.20%  (p=0.001 n=10+7)
      MatchClass_InRange-12              2.12µs ± 0%    2.13µs ± 0%   +0.23%  (p=0.000 n=10+10)
      ReplaceAll-12                      1.41µs ± 0%    1.39µs ± 0%   -1.30%  (p=0.000 n=7+10)
      AnchoredLiteralShortNonMatch-12    89.8ns ± 0%    83.2ns ± 0%   -7.35%  (p=0.000 n=8+8)
      AnchoredLiteralLongNonMatch-12      105ns ± 3%     105ns ± 0%     ~     (p=0.186 n=10+10)
      AnchoredShortMatch-12               141ns ± 0%     131ns ± 0%   -7.09%  (p=0.000 n=9+10)
      AnchoredLongMatch-12                276ns ± 4%     267ns ± 0%   -3.23%  (p=0.000 n=10+10)
      OnePassShortA-12                    620ns ± 0%     611ns ± 0%   -1.39%  (p=0.000 n=10+9)
      NotOnePassShortA-12                 575ns ± 3%     552ns ± 0%   -3.97%  (p=0.000 n=10+8)
      OnePassShortB-12                    493ns ± 0%     491ns ± 0%   -0.33%  (p=0.000 n=8+8)
      NotOnePassShortB-12                 423ns ± 0%     412ns ± 0%   -2.60%  (p=0.000 n=8+9)
      OnePassLongPrefix-12                112ns ± 0%     112ns ± 0%     ~     (all equal)
      OnePassLongNotPrefix-12             405ns ± 0%     410ns ± 0%   +1.23%  (p=0.000 n=8+9)
      MatchParallelShared-12              501ns ± 1%      39ns ± 1%  -92.27%  (p=0.000 n=10+10)
      MatchParallelCopied-12             39.1ns ± 0%    39.2ns ± 3%     ~     (p=0.785 n=6+10)
      QuoteMetaAll-12                    94.6ns ± 0%    94.6ns ± 0%     ~     (p=0.439 n=10+8)
      QuoteMetaNone-12                   52.7ns ± 0%    52.7ns ± 0%     ~     (all equal)
      Match/Easy0/32-12                  79.1ns ± 0%    72.9ns ± 0%   -7.85%  (p=0.000 n=9+9)
      Match/Easy0/1K-12                   307ns ± 1%     298ns ± 0%   -2.99%  (p=0.000 n=10+6)
      Match/Easy0/32K-12                 4.65µs ± 2%    4.60µs ± 2%     ~     (p=0.159 n=10+10)
      Match/Easy0/1M-12                   234µs ± 0%     235µs ± 0%   +0.17%  (p=0.003 n=10+10)
      Match/Easy0/32M-12                 7.98ms ± 1%    7.96ms ± 0%     ~     (p=0.278 n=9+10)
      Match/Easy0i/32-12                 1.13µs ± 1%    1.09µs ± 0%   -3.24%  (p=0.000 n=9+8)
      Match/Easy0i/1K-12                 32.5µs ± 0%    31.7µs ± 0%   -2.66%  (p=0.000 n=9+9)
      Match/Easy0i/32K-12                1.59ms ± 0%    1.61ms ± 0%   +0.75%  (p=0.000 n=9+9)
      Match/Easy0i/1M-12                 51.0ms ± 0%    51.4ms ± 0%   +0.77%  (p=0.000 n=10+8)
      Match/Easy0i/32M-12                 1.63s ± 0%     1.65s ± 1%   +1.24%  (p=0.000 n=7+9)
      Match/Easy1/32-12                  75.1ns ± 1%    67.9ns ± 0%   -9.54%  (p=0.000 n=8+8)
      Match/Easy1/1K-12                   861ns ± 0%     884ns ± 0%   +2.71%  (p=0.000 n=8+9)
      Match/Easy1/32K-12                 39.2µs ± 1%    39.2µs ± 0%     ~     (p=0.090 n=10+9)
      Match/Easy1/1M-12                  1.38ms ± 0%    1.39ms ± 0%     ~     (p=0.095 n=10+9)
      Match/Easy1/32M-12                 44.2ms ± 1%    44.2ms ± 1%     ~     (p=0.218 n=10+10)
      Match/Medium/32-12                 1.04µs ± 1%    1.05µs ± 0%   +1.05%  (p=0.000 n=9+8)
      Match/Medium/1K-12                 31.3µs ± 0%    31.3µs ± 0%   -0.14%  (p=0.004 n=9+9)
      Match/Medium/32K-12                1.44ms ± 0%    1.45ms ± 0%   +0.18%  (p=0.001 n=8+8)
      Match/Medium/1M-12                 46.1ms ± 0%    46.2ms ± 0%   +0.13%  (p=0.003 n=6+9)
      Match/Medium/32M-12                 1.48s ± 0%     1.48s ± 0%   +0.20%  (p=0.002 n=9+8)
      Match/Hard/32-12                   1.54µs ± 1%    1.49µs ± 0%   -3.60%  (p=0.000 n=9+10)
      Match/Hard/1K-12                   46.4µs ± 1%    45.1µs ± 1%   -2.78%  (p=0.000 n=9+10)
      Match/Hard/32K-12                  2.19ms ± 0%    2.18ms ± 1%   -0.51%  (p=0.006 n=8+9)
      Match/Hard/1M-12                   70.1ms ± 0%    69.7ms ± 1%   -0.52%  (p=0.006 n=8+9)
      Match/Hard/32M-12                   2.24s ± 0%     2.23s ± 1%   -0.42%  (p=0.046 n=8+9)
      Match/Hard1/32-12                  8.17µs ± 1%    7.89µs ± 0%   -3.42%  (p=0.000 n=8+9)
      Match/Hard1/1K-12                   254µs ± 2%     244µs ± 0%   -3.91%  (p=0.000 n=9+9)
      Match/Hard1/32K-12                 9.58ms ± 1%   10.35ms ± 0%   +8.00%  (p=0.000 n=10+10)
      Match/Hard1/1M-12                   306ms ± 1%     331ms ± 0%   +8.27%  (p=0.000 n=9+8)
      Match/Hard1/32M-12                  9.79s ± 1%    10.60s ± 0%   +8.29%  (p=0.000 n=9+8)
      Match_onepass_regex/32-12           808ns ± 0%     812ns ± 0%   +0.47%  (p=0.000 n=8+10)
      Match_onepass_regex/1K-12          27.8µs ± 0%    28.5µs ± 0%   +2.32%  (p=0.000 n=8+10)
      Match_onepass_regex/32K-12          925µs ± 0%     936µs ± 0%   +1.24%  (p=0.000 n=9+10)
      Match_onepass_regex/1M-12          29.5ms ± 0%    30.2ms ± 0%   +2.38%  (p=0.000 n=10+10)
      Match_onepass_regex/32M-12          945ms ± 0%     970ms ± 0%   +2.60%  (p=0.000 n=9+10)
      CompileOnepass-12                  4.67µs ± 0%    4.63µs ± 1%   -0.84%  (p=0.000 n=10+10)
      [Geo mean]                         24.5µs         23.3µs        -5.04%
      
      https://perf.golang.org/search?q=upload:20181004.1
      
      Change-Id: Idbc2b76223718265657819ff38be2d9aba1c54b4
      Reviewed-on: https://go-review.googlesource.com/c/139779
      Run-TryBot: Russ Cox <rsc@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      2d4346b3
  2. 01 Jun, 2018 1 commit
  3. 31 Oct, 2017 1 commit
  4. 15 Sep, 2017 1 commit
  5. 23 Mar, 2017 1 commit
    • haya14busa's avatar
      regexp: reduce allocs in regexp.Match for onepass regex · 8a16d7d4
      haya14busa authored
      There were no allocations in regexp.Match for *non* onepass regex
      because m.matchcap length is reset to zero (ncap=0 for regexp.Match).
      
      But, as for onepass regex, m.matchcap length remains as it is even when
      ncap=0 and it leads needless allocations.
      
      benchmark                                    old ns/op      new ns/op      delta
      BenchmarkMatch_onepass_regex/32-4      6465           4628           -28.41%
      BenchmarkMatch_onepass_regex/1K-4      208324         151558         -27.25%
      BenchmarkMatch_onepass_regex/32K-4     7230259        5834492        -19.30%
      BenchmarkMatch_onepass_regex/1M-4      234379810      166310682      -29.04%
      BenchmarkMatch_onepass_regex/32M-4     7903529363     4981119950     -36.98%
      
      benchmark                                    old MB/s     new MB/s     speedup
      BenchmarkMatch_onepass_regex/32-4      4.95         6.91         1.40x
      BenchmarkMatch_onepass_regex/1K-4      4.92         6.76         1.37x
      BenchmarkMatch_onepass_regex/32K-4     4.53         5.62         1.24x
      BenchmarkMatch_onepass_regex/1M-4      4.47         6.30         1.41x
      BenchmarkMatch_onepass_regex/32M-4     4.25         6.74         1.59x
      
      benchmark                                    old allocs     new allocs     delta
      BenchmarkMatch_onepass_regex/32-4      32             0              -100.00%
      BenchmarkMatch_onepass_regex/1K-4      1024           0              -100.00%
      BenchmarkMatch_onepass_regex/32K-4     32768          0              -100.00%
      BenchmarkMatch_onepass_regex/1M-4      1048576        0              -100.00%
      BenchmarkMatch_onepass_regex/32M-4     104559255      0              -100.00%
      
      benchmark                                    old bytes      new bytes     delta
      BenchmarkMatch_onepass_regex/32-4      512            0             -100.00%
      BenchmarkMatch_onepass_regex/1K-4      16384          0             -100.00%
      BenchmarkMatch_onepass_regex/32K-4     524288         0             -100.00%
      BenchmarkMatch_onepass_regex/1M-4      16777216       0             -100.00%
      BenchmarkMatch_onepass_regex/32M-4     2019458128     0             -100.00%
      
      Fixes #19573
      
      Change-Id: I033982d0003ebb0360bb40b92eb3941c781ec74d
      Reviewed-on: https://go-review.googlesource.com/38270
      Run-TryBot: Michael Matloob <matloob@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      8a16d7d4
  6. 06 Sep, 2016 1 commit
    • Aliaksandr Valialkin's avatar
      regexp: reduce mallocs in Regexp.Find* and Regexp.ReplaceAll*. · bea39e63
      Aliaksandr Valialkin authored
      This improves Regexp.Find* and Regexp.ReplaceAll* speed:
      
      name                  old time/op    new time/op    delta
      Find-4                   345ns ± 1%     314ns ± 1%    -8.94%    (p=0.000 n=9+8)
      FindString-4             341ns ± 1%     308ns ± 0%    -9.85%   (p=0.000 n=10+9)
      FindSubmatch-4           440ns ± 1%     404ns ± 0%    -8.27%   (p=0.000 n=10+8)
      FindStringSubmatch-4     426ns ± 0%     387ns ± 0%    -9.07%   (p=0.000 n=10+9)
      ReplaceAll-4            1.75µs ± 1%    1.67µs ± 0%    -4.45%   (p=0.000 n=9+10)
      
      name                  old alloc/op   new alloc/op   delta
      Find-4                   16.0B ± 0%     0.0B ±NaN%  -100.00%  (p=0.000 n=10+10)
      FindString-4             16.0B ± 0%     0.0B ±NaN%  -100.00%  (p=0.000 n=10+10)
      FindSubmatch-4           80.0B ± 0%     48.0B ± 0%   -40.00%  (p=0.000 n=10+10)
      FindStringSubmatch-4     64.0B ± 0%     32.0B ± 0%   -50.00%  (p=0.000 n=10+10)
      ReplaceAll-4              152B ± 0%      104B ± 0%   -31.58%  (p=0.000 n=10+10)
      
      name                  old allocs/op  new allocs/op  delta
      Find-4                    1.00 ± 0%     0.00 ±NaN%  -100.00%  (p=0.000 n=10+10)
      FindString-4              1.00 ± 0%     0.00 ±NaN%  -100.00%  (p=0.000 n=10+10)
      FindSubmatch-4            2.00 ± 0%      1.00 ± 0%   -50.00%  (p=0.000 n=10+10)
      FindStringSubmatch-4      2.00 ± 0%      1.00 ± 0%   -50.00%  (p=0.000 n=10+10)
      ReplaceAll-4              8.00 ± 0%      5.00 ± 0%   -37.50%  (p=0.000 n=10+10)
      
      Fixes #15643
      
      Change-Id: I594fe51172373e2adb98d1d25c76ca2cde54ff48
      Reviewed-on: https://go-review.googlesource.com/23030Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      bea39e63
  7. 25 Mar, 2016 1 commit
    • Dominik Honnef's avatar
      all: delete dead non-test code · fdba5a75
      Dominik Honnef authored
      This change removes a lot of dead code. Some of the code has never been
      used, not even when it was first commited. The rest shouldn't have
      survived refactors.
      
      This change doesn't remove unused routines helpful for debugging, nor
      does it remove code that's used in commented out blocks of code that are
      only unused temporarily. Furthermore, unused constants weren't removed
      when they were part of a set of constants from specifications.
      
      One noteworthy omission from this CL are about 1000 lines of unused code
      in cmd/fix, 700 lines of which are the typechecker, which hasn't been
      used ever since the pre-Go 1 fixes have been removed. I wasn't sure if
      this code should stick around for future uses of cmd/fix or be culled as
      well.
      
      Change-Id: Ib714bc7e487edc11ad23ba1c3222d1fd02e4a549
      Reviewed-on: https://go-review.googlesource.com/20926Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      fdba5a75
  8. 02 Mar, 2016 1 commit
    • Brad Fitzpatrick's avatar
      all: single space after period. · 5fea2ccc
      Brad Fitzpatrick authored
      The tree's pretty inconsistent about single space vs double space
      after a period in documentation. Make it consistently a single space,
      per earlier decisions. This means contributors won't be confused by
      misleading precedence.
      
      This CL doesn't use go/doc to parse. It only addresses // comments.
      It was generated with:
      
      $ perl -i -npe 's,^(\s*// .+[a-z]\.)  +([A-Z]),$1 $2,' $(git grep -l -E '^\s*//(.+\.)  +([A-Z])')
      $ go test go/doc -update
      
      Change-Id: Iccdb99c37c797ef1f804a94b22ba5ee4b500c4f7
      Reviewed-on: https://go-review.googlesource.com/20022Reviewed-by: default avatarRob Pike <r@golang.org>
      Reviewed-by: default avatarDave Day <djd@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      5fea2ccc
  9. 23 Mar, 2015 1 commit
    • Michael Matloob's avatar
      regexp: port RE2's bitstate backtracker to the regexp package · 93238623
      Michael Matloob authored
      This is a port of RE2's bitstate backtracker, which triggers under
      the same conditions that the RE2 backtracker triggers.  However I wasn't
      sure how to port over some of the optimizations in the RE2 backtracker,
      and there is a ~2% penalty on benchmarks that don't trigger the backtracker.
      
      benchmark                                 old ns/op      new ns/op      delta
      BenchmarkLiteral                          312            189            -39.42%
      BenchmarkNotLiteral                       4435           3001           -32.33%
      BenchmarkMatchClass                       5758           4378           -23.97%
      BenchmarkMatchClass_InRange               5385           4084           -24.16%
      BenchmarkReplaceAll                       5291           3505           -33.76%
      BenchmarkAnchoredLiteralShortNonMatch     190            200            +5.26%
      BenchmarkAnchoredLiteralLongNonMatch      189            194            +2.65%
      BenchmarkAnchoredShortMatch               479            304            -36.53%
      BenchmarkAnchoredLongMatch                478            499            +4.39%
      BenchmarkOnePassShortA                    791            798            +0.88%
      BenchmarkNotOnePassShortA                 3202           1571           -50.94%
      BenchmarkOnePassShortB                    614            633            +3.09%
      BenchmarkNotOnePassShortB                 2685           881            -67.19%
      BenchmarkOnePassLongPrefix                152            154            +1.32%
      BenchmarkOnePassLongNotPrefix             505            533            +5.54%
      BenchmarkMatchEasy0_32                    139            171            +23.02%
      BenchmarkMatchEasy0_1K                    653            1797           +175.19%
      BenchmarkMatchEasy0_32K                   12032          13346          +10.92%
      BenchmarkMatchEasy0_1M                    462882         461272         -0.35%
      BenchmarkMatchEasy0_32M                   15015339       15365238       +2.33%
      BenchmarkMatchEasy1_32                    122            168            +37.70%
      BenchmarkMatchEasy1_1K                    3339           2612           -21.77%
      BenchmarkMatchEasy1_32K                   72330          71721          -0.84%
      BenchmarkMatchEasy1_1M                    2545410        2652284        +4.20%
      BenchmarkMatchEasy1_32M                   80072063       82609750       +3.17%
      BenchmarkMatchMedium_32                   2359           1980           -16.07%
      BenchmarkMatchMedium_1K                   75939          58593          -22.84%
      BenchmarkMatchMedium_32K                  2450907        2501106        +2.05%
      BenchmarkMatchMedium_1M                   78707697       80174418       +1.86%
      BenchmarkMatchMedium_32M                  2535146010     2570896441     +1.41%
      BenchmarkMatchHard_32                     4297           2960           -31.11%
      BenchmarkMatchHard_1K                     133592         88997          -33.38%
      BenchmarkMatchHard_32K                    4240445        4336907        +2.27%
      BenchmarkMatchHard_1M                     136187006      139350238      +2.32%
      BenchmarkMatchHard_32M                    4350855890     4478537306     +2.93%
      
      benchmark                    old MB/s     new MB/s     speedup
      BenchmarkMatchEasy0_32       228.74       186.11       0.81x
      BenchmarkMatchEasy0_1K       1565.91      569.64       0.36x
      BenchmarkMatchEasy0_32K      2723.31      2455.10      0.90x
      BenchmarkMatchEasy0_1M       2265.32      2273.22      1.00x
      BenchmarkMatchEasy0_32M      2234.68      2183.79      0.98x
      BenchmarkMatchEasy1_32       261.08       190.22       0.73x
      BenchmarkMatchEasy1_1K       306.59       391.91       1.28x
      BenchmarkMatchEasy1_32K      453.03       456.88       1.01x
      BenchmarkMatchEasy1_1M       411.95       395.35       0.96x
      BenchmarkMatchEasy1_32M      419.05       406.18       0.97x
      BenchmarkMatchMedium_32      13.56        16.16        1.19x
      BenchmarkMatchMedium_1K      13.48        17.48        1.30x
      BenchmarkMatchMedium_32K     13.37        13.10        0.98x
      BenchmarkMatchMedium_1M      13.32        13.08        0.98x
      BenchmarkMatchMedium_32M     13.24        13.05        0.99x
      BenchmarkMatchHard_32        7.45         10.81        1.45x
      BenchmarkMatchHard_1K        7.67         11.51        1.50x
      BenchmarkMatchHard_32K       7.73         7.56         0.98x
      BenchmarkMatchHard_1M        7.70         7.52         0.98x
      BenchmarkMatchHard_32M       7.71         7.49         0.97x
      
      Fixes #4154
      
      Change-Id: Iff7fb9507f0872b320d08afc08679751ed1b28bc
      Reviewed-on: https://go-review.googlesource.com/2153Reviewed-by: default avatarRuss Cox <rsc@golang.org>
      93238623
  10. 08 Sep, 2014 1 commit
  11. 28 May, 2014 1 commit
    • Russ Cox's avatar
      regexp: hide one-pass code from exported API · 6c10e64a
      Russ Cox authored
      Update #8112
      
      Hide one-pass regexp API.
      
      This means moving the code from regexp/syntax to regexp,
      but it avoids being locked into the specific API chosen for
      the implementation.
      
      It also removes a slice field from the syntax.Inst, which
      should avoid bloating the memory footprint of a non-one-pass
      regexp unnecessarily.
      
      LGTM=r
      R=golang-codereviews, r
      CC=golang-codereviews, iant
      https://golang.org/cl/98610046
      6c10e64a
  12. 07 Mar, 2014 1 commit
  13. 19 Jan, 2012 1 commit
  14. 07 Dec, 2011 1 commit
    • Russ Cox's avatar
      regexp: avoid allocation of input interface · 2f2cc24c
      Russ Cox authored
      Matters most for small inputs, because there is no real work
      to amortize the allocation effort against.
      
      benchmark                                old ns/op    new ns/op    delta
      BenchmarkLiteral                               613          473  -22.84%
      BenchmarkNotLiteral                           4981         4931   -1.00%
      BenchmarkMatchClass                           7289         7122   -2.29%
      BenchmarkMatchClass_InRange                   6618         6663   +0.68%
      BenchmarkReplaceAll                           7843         7233   -7.78%
      BenchmarkAnchoredLiteralShortNonMatch          329          228  -30.70%
      BenchmarkAnchoredLiteralLongNonMatch           322          228  -29.19%
      BenchmarkAnchoredShortMatch                    838          715  -14.68%
      BenchmarkAnchoredLongMatch                     824          715  -13.23%
      
      benchmark                                 old MB/s     new MB/s  speedup
      BenchmarkMatchEasy0_32                      119.73       196.61    1.64x
      BenchmarkMatchEasy0_1K                      540.58       538.33    1.00x
      BenchmarkMatchEasy0_32K                     732.57       714.00    0.97x
      BenchmarkMatchEasy0_1M                      726.44       708.36    0.98x
      BenchmarkMatchEasy0_32M                     707.77       691.45    0.98x
      BenchmarkMatchEasy1_32                      102.12       136.11    1.33x
      BenchmarkMatchEasy1_1K                      298.31       307.04    1.03x
      BenchmarkMatchEasy1_32K                     273.56       274.43    1.00x
      BenchmarkMatchEasy1_1M                      268.42       269.23    1.00x
      BenchmarkMatchEasy1_32M                     266.15       267.34    1.00x
      BenchmarkMatchMedium_32                       2.53         3.38    1.34x
      BenchmarkMatchMedium_1K                       9.37         9.57    1.02x
      BenchmarkMatchMedium_32K                      9.29         9.67    1.04x
      BenchmarkMatchMedium_1M                       9.42         9.66    1.03x
      BenchmarkMatchMedium_32M                      9.41         9.62    1.02x
      BenchmarkMatchHard_32                         6.66         6.75    1.01x
      BenchmarkMatchHard_1K                         6.81         6.85    1.01x
      BenchmarkMatchHard_32K                        6.79         6.85    1.01x
      BenchmarkMatchHard_1M                         6.82         6.83    1.00x
      BenchmarkMatchHard_32M                        6.80         6.80    1.00x
      
      R=golang-dev, r
      CC=golang-dev
      https://golang.org/cl/5453076
      2f2cc24c
  15. 26 Oct, 2011 1 commit
  16. 28 Sep, 2011 1 commit
    • Russ Cox's avatar
      regexp: speedups · 8f699a3f
      Russ Cox authored
      MatchEasy0_1K        500000        4207 ns/op   243.35 MB/s
      MatchEasy0_1K_Old    500000        4625 ns/op   221.40 MB/s
      MatchEasy0_1M           500     3948932 ns/op   265.53 MB/s
      MatchEasy0_1M_Old       500     3943926 ns/op   265.87 MB/s
      MatchEasy0_32K        10000      122974 ns/op   266.46 MB/s
      MatchEasy0_32K_Old    10000      123270 ns/op   265.82 MB/s
      MatchEasy0_32M           10   127265400 ns/op   263.66 MB/s
      MatchEasy0_32M_Old       10   127123500 ns/op   263.95 MB/s
      MatchEasy1_1K        500000        5637 ns/op   181.63 MB/s
      MatchEasy1_1K_Old     10000      100690 ns/op    10.17 MB/s
      MatchEasy1_1M           200     7683150 ns/op   136.48 MB/s
      MatchEasy1_1M_Old        10   145774000 ns/op     7.19 MB/s
      MatchEasy1_32K        10000      239887 ns/op   136.60 MB/s
      MatchEasy1_32K_Old      500     4508182 ns/op     7.27 MB/s
      MatchEasy1_32M           10   247103500 ns/op   135.79 MB/s
      MatchEasy1_32M_Old        1  4660191000 ns/op     7.20 MB/s
      MatchMedium_1K        10000      160567 ns/op     6.38 MB/s
      MatchMedium_1K_Old    10000      158367 ns/op     6.47 MB/s
      MatchMedium_1M           10   162928000 ns/op     6.44 MB/s
      MatchMedium_1M_Old       10   159699200 ns/op     6.57 MB/s
      MatchMedium_32K         500     5090758 ns/op     6.44 MB/s
      MatchMedium_32K_Old     500     5005800 ns/op     6.55 MB/s
      MatchMedium_32M           1  5233973000 ns/op     6.41 MB/s
      MatchMedium_32M_Old       1  5109676000 ns/op     6.57 MB/s
      MatchHard_1K          10000      249087 ns/op     4.11 MB/s
      MatchHard_1K_Old       5000      364569 ns/op     2.81 MB/s
      MatchHard_1M              5   256050000 ns/op     4.10 MB/s
      MatchHard_1M_Old          5   372446400 ns/op     2.82 MB/s
      MatchHard_32K           200     7944525 ns/op     4.12 MB/s
      MatchHard_32K_Old       100    11609380 ns/op     2.82 MB/s
      MatchHard_32M             1  8144503000 ns/op     4.12 MB/s
      MatchHard_32M_Old         1 11885434000 ns/op     2.82 MB/s
      
      R=r, bradfitz
      CC=golang-dev
      https://golang.org/cl/5134049
      8f699a3f
  17. 26 Sep, 2011 1 commit
  18. 08 Sep, 2011 1 commit
  19. 07 Sep, 2011 1 commit
    • Russ Cox's avatar
      exp/regexp: bug fixes and RE2 tests · 08ae1a5a
      Russ Cox authored
      Also add exp/regexp to build (forgot before).
      
      At this point I am very confident in exp/regexp's
      behavior.  It should be usable as a drop-in
      replacement for regexp now.
      
      Later CLs could introduce a CompilePOSIX
      to get at traditional POSIX ``extended regular expressions''
      as in egrep and also an re.MatchLongest method to
      change the matching mode to leftmost longest
      instead of leftmost first.  On the other hand, I expect
      very few people to use either.
      
      R=r, r, gustavo
      CC=golang-dev
      https://golang.org/cl/4990041
      08ae1a5a
  20. 24 Jul, 2011 1 commit
    • Russ Cox's avatar
      exp/regexp: implement regexp API using exp/regexp/syntax · a1e7cd97
      Russ Cox authored
      Still need to write tests for new syntax
      and fix bugs that the tests find, but this
      is a good check point.
      
      All tests pass.
      
      Compared against existing regexp:
      
      benchmark                                old ns/op    new ns/op    delta
      regexp.BenchmarkLiteral                       1869          620  -66.83%
      regexp.BenchmarkNotLiteral                    9489         7823  -17.56%
      regexp.BenchmarkMatchClass                   10372         8386  -19.15%
      regexp.BenchmarkMatchClass_InRange           10800         7750  -28.24%
      regexp.BenchmarkReplaceAll                   13492         8519  -36.86%
      regexp.BenchmarkAnchoredLiteralShortNonMatch   747          339  -54.62%
      regexp.BenchmarkAnchoredLiteralLongNonMatch    599          335  -44.07%
      regexp.BenchmarkAnchoredShortMatch            2137          917  -57.09%
      regexp.BenchmarkAnchoredLongMatch             2029          917  -54.81%
      
      R=r, r
      CC=golang-dev, sam.thorogood
      https://golang.org/cl/4820046
      a1e7cd97