]> Cypherpunks repositories - gostls13.git/commit
internal/lazyregexp: add a lazy Regexp package
authorDaniel Martí <mvdan@mvdan.cc>
Wed, 27 Feb 2019 12:09:22 +0000 (13:09 +0100)
committerDaniel Martí <mvdan@mvdan.cc>
Wed, 27 Feb 2019 15:58:10 +0000 (15:58 +0000)
commitf40cb19affbb3be090b3519f957b5198744022be
tree7af91b7c3a5e134c45751844bfabf4989c2ffbf4
parent0d8c3637b1482402eb5328ca089862eb30fa636a
internal/lazyregexp: add a lazy Regexp package

This was implemented as part of go/doc, but it's going to be useful in
other packages. In particular, many packages under cmd/go like web and
vcs make somewhat heavy use of global regexes, which add a non-trivial
amount of init work to the cmd/go program.

A lazy wrapper around regexp.Regexp will make it trivial to get rid of
the extra cost with a trivial refactor, so make it possible for other
packages in the repository to make use of it. While naming the package,
give the members better names, such as lazyregexp.New and
lazyregexp.Regexp.

We're also considering adding some form of a lazy API to the public
regexp package, so this internal package will allow us to get some
initial experience across std and cmd.

For #29382.

Change-Id: I30b0e72871d5267c309786f95f4cb15c68b2393d
Reviewed-on: https://go-review.googlesource.com/c/164040
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/go/build/deps_test.go
src/go/doc/comment.go
src/go/doc/reader.go
src/internal/lazyregexp/lazyre.go [moved from src/go/doc/lazyre.go with 66% similarity]