]> Cypherpunks repositories - gostls13.git/commit
regexp: fix performance bug, make anchored searches fail fast.
authorRob Pike <r@golang.org>
Mon, 3 Jan 2011 19:31:51 +0000 (11:31 -0800)
committerRob Pike <r@golang.org>
Mon, 3 Jan 2011 19:31:51 +0000 (11:31 -0800)
commitc0d0d4ef05378c6a297e36c60b7af2b799f5653f
treebe0f9f1c8a5f3b8197fe30a122b180882a62f048
parent84fc1e20f17097c1b6710f79cdd03dafeb908eaf
regexp: fix performance bug, make anchored searches fail fast.

The bug was that for an anchored pattern such as ^x, the prefix
scan ignored the anchor, and could scan the whole file if there was
no x present.  The fix is to do prefix matching after the anchor;
the cost miniscule; the speedups huge.

R=rsc, gri
CC=golang-dev
https://golang.org/cl/3837042
src/pkg/regexp/all_test.go
src/pkg/regexp/regexp.go