aboutsummaryrefslogtreecommitdiff
path: root/src/regexp
diff options
context:
space:
mode:
authorRick Hudson <rlh@golang.org>2016-04-27 18:19:16 -0400
committerRick Hudson <rlh@golang.org>2016-04-27 18:46:52 -0400
commit23aeb34df172b17b7bfaa85fb59ca64bef9073bb (patch)
treea8ab866f1e50f0059856ce628f036d93ab620155 /src/regexp
parent1354b32cd70f2702381764fd595dd2faa996840c (diff)
parentd3c79d324acd7300b6f705e66af8ca711af00d9f (diff)
downloadgo-23aeb34df172b17b7bfaa85fb59ca64bef9073bb.tar.xz
[dev.garbage] Merge remote-tracking branch 'origin/master' into HEAD
Change-Id: I282fd9ce9db435dfd35e882a9502ab1abc185297
Diffstat (limited to 'src/regexp')
-rw-r--r--src/regexp/exec_test.go12
-rw-r--r--src/regexp/onepass.go2
2 files changed, 13 insertions, 1 deletions
diff --git a/src/regexp/exec_test.go b/src/regexp/exec_test.go
index cfc1e147c1..463fcf1848 100644
--- a/src/regexp/exec_test.go
+++ b/src/regexp/exec_test.go
@@ -672,9 +672,11 @@ func benchmark(b *testing.B, re string, n int) {
const (
easy0 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ$"
+ easy0i = "(?i)ABCDEFGHIJklmnopqrstuvwxyz$"
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) }
@@ -682,6 +684,11 @@ func BenchmarkMatchEasy0_1K(b *testing.B) { benchmark(b, easy0, 1<<10) }
func BenchmarkMatchEasy0_32K(b *testing.B) { benchmark(b, easy0, 32<<10) }
func BenchmarkMatchEasy0_1M(b *testing.B) { benchmark(b, easy0, 1<<20) }
func BenchmarkMatchEasy0_32M(b *testing.B) { benchmark(b, easy0, 32<<20) }
+func BenchmarkMatchEasy0i_32(b *testing.B) { benchmark(b, easy0i, 32<<0) }
+func BenchmarkMatchEasy0i_1K(b *testing.B) { benchmark(b, easy0i, 1<<10) }
+func BenchmarkMatchEasy0i_32K(b *testing.B) { benchmark(b, easy0i, 32<<10) }
+func BenchmarkMatchEasy0i_1M(b *testing.B) { benchmark(b, easy0i, 1<<20) }
+func BenchmarkMatchEasy0i_32M(b *testing.B) { benchmark(b, easy0i, 32<<20) }
func BenchmarkMatchEasy1_32(b *testing.B) { benchmark(b, easy1, 32<<0) }
func BenchmarkMatchEasy1_1K(b *testing.B) { benchmark(b, easy1, 1<<10) }
func BenchmarkMatchEasy1_32K(b *testing.B) { benchmark(b, easy1, 32<<10) }
@@ -697,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)`)
diff --git a/src/regexp/onepass.go b/src/regexp/onepass.go
index 5b82f9666e..4991954820 100644
--- a/src/regexp/onepass.go
+++ b/src/regexp/onepass.go
@@ -450,7 +450,7 @@ func makeOnePass(p *onePassProg) *onePassProg {
for !instQueue.empty() {
visitQueue.clear()
pc := instQueue.next()
- if !check(uint32(pc), m) {
+ if !check(pc, m) {
p = notOnePass
break
}