From 70d95a488da89d268d0a61171ec389982a62184d Mon Sep 17 00:00:00 2001 From: Michael Matloob Date: Tue, 26 Apr 2016 15:28:17 -0400 Subject: [PATCH] regexp: add a harder regexp to the benchmarks This regexp has many parallel alternations Change-Id: I8044f460aa7d18f20cb0452e9470557b87facd6d Reviewed-on: https://go-review.googlesource.com/22471 Reviewed-by: Brad Fitzpatrick Run-TryBot: Brad Fitzpatrick TryBot-Result: Gobot Gobot --- src/regexp/exec_test.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/regexp/exec_test.go b/src/regexp/exec_test.go index f8f5f4020e..463fcf1848 100644 --- a/src/regexp/exec_test.go +++ b/src/regexp/exec_test.go @@ -676,6 +676,7 @@ const ( easy1 = "A[AB]B[BC]C[CD]D[DE]E[EF]F[FG]G[GH]H[HI]I[IJ]J$" medium = "[XYZ]ABCDEFGHIJKLMNOPQRSTUVWXYZ$" hard = "[ -~]*ABCDEFGHIJKLMNOPQRSTUVWXYZ$" + hard1 = "ABCD|CDEF|EFGH|GHIJ|IJKL|KLMN|MNOP|OPQR|QRST|STUV|UVWX|WXYZ" ) func BenchmarkMatchEasy0_32(b *testing.B) { benchmark(b, easy0, 32<<0) } @@ -703,6 +704,11 @@ func BenchmarkMatchHard_1K(b *testing.B) { benchmark(b, hard, 1<<10) } func BenchmarkMatchHard_32K(b *testing.B) { benchmark(b, hard, 32<<10) } func BenchmarkMatchHard_1M(b *testing.B) { benchmark(b, hard, 1<<20) } func BenchmarkMatchHard_32M(b *testing.B) { benchmark(b, hard, 32<<20) } +func BenchmarkMatchHard1_32(b *testing.B) { benchmark(b, hard1, 32<<0) } +func BenchmarkMatchHard1_1K(b *testing.B) { benchmark(b, hard1, 1<<10) } +func BenchmarkMatchHard1_32K(b *testing.B) { benchmark(b, hard1, 32<<10) } +func BenchmarkMatchHard1_1M(b *testing.B) { benchmark(b, hard1, 1<<20) } +func BenchmarkMatchHard1_32M(b *testing.B) { benchmark(b, hard1, 32<<20) } func TestLongest(t *testing.T) { re, err := Compile(`a(|b)`) -- 2.48.1