]> Cypherpunks repositories - gostls13.git/commit
go/doc: compile regexps lazily
authorBrad Fitzpatrick <bradfitz@golang.org>
Fri, 3 Aug 2018 19:21:11 +0000 (19:21 +0000)
committerBrad Fitzpatrick <bradfitz@golang.org>
Tue, 21 Aug 2018 02:51:10 +0000 (02:51 +0000)
commitfc5107c27011e1c1b70eb35a6fb7b3efd0cf3cea
tree7ad445c18a38c6038c3f3a0d80b659f692899790
parentc544e0fbdb7344b2025650aaf70bab3b09d72003
go/doc: compile regexps lazily

Compile go/doc's 4 regexps lazily, on demand.

Also, add a test for the one that had no test coverage.

This reduces init-time CPU as well as heap by ~20KB when they're not
used, which seems to be common enough. As an example, cmd/doc only
seems to use 1 of them. (as noted by temporary print statements)

Updates #26775

Change-Id: I85df89b836327a53fb8e1ace3f92480374270368
Reviewed-on: https://go-review.googlesource.com/127875
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/go/build/deps_test.go
src/go/doc/comment.go
src/go/doc/doc_test.go
src/go/doc/lazyre.go [new file with mode: 0644]
src/go/doc/reader.go