Proposal Details
For big packages with many tests, running
$ go test ./bigpkg -run=TestSingleTest
.... still results in Go compiling all of bigpkg's tests, even if only one of them will run.
Out of curiosity, I played with pushing down go test's -run regexp down into the compiler, to avoid compiling functions that aren't needed at test time.
Results:
Before
$ time ~/src/go/bin/go test -vet=off -run=TestIsServiceHost$ -count=1 ./control/cfgdb/
ok foo/control/cfgdb 0.417s
real 0m2.984s
user 0m3.941s
sys 0m0.847s
$ time ~/src/go/bin/go test -vet=off -run=TestIsServiceHost$ -count=1 ./control/cfgdb/
ok foo/control/cfgdb 0.418s
real 0m3.004s
user 0m3.965s
sys 0m0.806s
$ time ~/src/go/bin/go test -vet=off -run=TestIsServiceHost$ -count=1 ./control/cfgdb/
ok foo/control/cfgdb 0.421s
real 0m3.044s
user 0m4.054s
sys 0m0.772s
$ time ~/src/go/bin/go test -vet=off -run=TestIsServiceHost$ -count=1 ./control/cfgdb/
ok foo/control/cfgdb 0.419s
real 0m3.030s
user 0m4.012s
sys 0m0.823s
$ time ~/src/go/bin/go test -vet=off -run=TestIsServiceHost$ -count=1 ./control/cfgdb/
ok foo/control/cfgdb 0.421s
real 0m3.074s
user 0m4.095s
sys 0m0.802s
After
$ time ~/src/go/bin/go test -vet=off -run=TestIsServiceHost$ -count=1 ./control/cfgdb/
ok foo/control/cfgdb 0.407s
real 0m2.895s
user 0m3.861s
sys 0m0.782s
$ time ~/src/go/bin/go test -vet=off -run=TestIsServiceHost$ -count=1 ./control/cfgdb/
ok foo/control/cfgdb 0.401s
real 0m2.870s
user 0m3.841s
sys 0m0.779s
$ time ~/src/go/bin/go test -vet=off -run=TestIsServiceHost$ -count=1 ./control/cfgdb/
ok foo/control/cfgdb 0.401s
real 0m2.805s
user 0m3.748s
sys 0m0.790s
$ time ~/src/go/bin/go test -vet=off -run=TestIsServiceHost$ -count=1 ./control/cfgdb/
ok foo/control/cfgdb 0.392s
real 0m2.833s
user 0m3.851s
sys 0m0.767s
$ time ~/src/go/bin/go test -vet=off -run=TestIsServiceHost$ -count=1 ./control/cfgdb/
ok foo/control/cfgdb 0.399s
real 0m2.866s
user 0m3.841s
sys 0m0.783s
It's not amazingly better, but it's something.
Data provided for consideration either way.
I don't feel strongly about this proposal.
Proposal Details
For big packages with many tests, running
.... still results in Go compiling all of
bigpkg's tests, even if only one of them will run.Out of curiosity, I played with pushing down go test's
-runregexp down into the compiler, to avoid compiling functions that aren't needed at test time.Results:
Before
After
It's not amazingly better, but it's something.
Data provided for consideration either way.
I don't feel strongly about this proposal.