Skip to content

Commit

Permalink
regexp: update README
Browse files Browse the repository at this point in the history
  • Loading branch information
matloob committed Apr 27, 2016
1 parent 1501bee commit a9296bf
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,10 @@

See [golang.org/cl/12081](https://golang.org/cl/12081)

* The regexp conformance tests pass, but there's still work to be done on state cache management, thread-safety, and readability.
* Please don't use this in production.
* The regexp tests pass. Though there may still be uncaught bugs.
Let me know if you find any of them! No guarantees!
* regexp/internal/dfa tests are currently failing. I need to fix
some thingsn there.
* I've got a small change to the DFA that uses package unsafe
and makes matches 2x faster. I'll try to get it up soon.
* A bunch of cleanup needs to be done all over this package.
6 changes: 6 additions & 0 deletions exec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,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 = "ABCE|CDEG|GHIK|HIJM|IJKN|KLMO|LMNP|PQRT|STUW|WXYA"
)

func BenchmarkMatchEasy0_32(b *testing.B) { benchmark(b, easy0, 32<<0) }
Expand All @@ -697,6 +698,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)`)
Expand Down
8 changes: 4 additions & 4 deletions internal/dfa/dfa.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,18 +88,18 @@ var errFallBack = errors.New("falling back to NFA")
func (d *DFA) loadNextState(from *State, r rune) *State {
// TODO(matloob): Do an atomic read from from.next and eliminate mutex.
runerange := d.rangemap.lookup(r)
from.mu.Lock()
// from.mu.Lock()
s := from.next[runerange]
from.mu.Unlock()
// from.mu.Unlock()
return s
}

func (d *DFA) storeNextState(from *State, r rune, to *State) {
// TODO(matloob): Do an atomic write to from.next and eliminate mutex.
runerange := d.rangemap.lookup(r)
from.mu.Lock()
// from.mu.Lock()
from.next[runerange] = to
from.mu.Unlock()
// from.mu.Unlock()
}

func (d *DFA) analyzeSearch(params *searchParams) bool {
Expand Down

0 comments on commit a9296bf

Please sign in to comment.