testdata: avoid fmt in the implement test script
Like other tests, importing fmt results in quite a lot of extra work, due to the lack of build caching. In this particular test, we wanted fmt.Println so that T.String would be called in an indirect way, without defining or referencing Stringer interface in the main package. We can do that by rolling our own "tinyfmt" package in a dozen or so lines of code. Below is how 'go test -short -vet=off -run Script/implement' is affected, measured via benchcmd and benchstat: name old time/op new time/op delta GoTestScriptImplement 3.67s ± 9% 2.65s ±11% -27.68% (p=0.008 n=5+5) name old user-time/op new user-time/op delta GoTestScriptImplement 8.18s ± 4% 4.55s ± 9% -44.35% (p=0.008 n=5+5) name old sys-time/op new sys-time/op delta GoTestScriptImplement 1.27s ±12% 0.71s ±13% -44.07% (p=0.008 n=5+5) name old peak-RSS-bytes new peak-RSS-bytes delta GoTestScriptImplement 145MB ± 1% 145MB ± 2% ~ (p=1.000 n=5+5) All in all, we shave about one full second. It doesn't seem to affect the total 'go test -short' noticeably, but every little bit counts.pull/97/head
parent
ad44350cd0
commit
c8b2cbaa36
Loading…
Reference in New Issue