Closed dolmen closed 1 year ago
@frankban Please merge #157 first. I'll do the rebase of #160 on top.
@frankban Rebased.
This important optimization (with my other fixes) are worth a release.
ping @frankban
This looks very interesting. We are discussing with @rogpeppe about other possible ways for introducing this optimization. Thanks for this work!
I could go further and completely remove the getRunFuncSignature
. At this point the cache is statically filled and getRunFuncSignature
is only used at runtime for error reporting in the case of a bad usage (and also for the benchmark that would go too): this could be replaced by a simple message displaying the signature of the received function and the list of acceptable ones.
An alternate implementation would use generics to enforce the signature at compile time. But are you ready to push the minimum Go version required from 1.13 to 1.18?
Well, Go doesn't have generic methods yet, so I don't see how a compile-time check of the subtest signature could be enforced.
Rebased on top of v1.14.6.
Replaced by #165 which completely bypass reflect
in the common cases for which we used a cache here.
In
C.Run
bypass check of the signature of theRun
method ofc.TB
by using a prefilled table for the common cases of*testing.T
,*testing.B
and*quicktest.C
.This serie of patches shows the developement process:
getRunFuncSignature
getRunFuncSignature
getRunFuncSignature
and add aBenchmarkCRunGetFuncSig
to compare themgetRunFuncSignatureCache
(see commit for results)getRunFuncSignatureCache
instead ofgetRunFuncSignature
inC.Run