forked from rosa/hakurei
internal/pkg: benchmark early DCE
This error has never had decent performance, now is a good time to improve that. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -1603,6 +1603,24 @@ func (a earlyFailureF) Cure(*pkg.FContext) error {
|
|||||||
return stub.UniqueError(0xcafe)
|
return stub.UniqueError(0xcafe)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func BenchmarkEarlyDCE(b *testing.B) {
|
||||||
|
msg := message.New(log.New(os.Stderr, "dce: ", 0))
|
||||||
|
msg.SwapVerbose(testing.Verbose())
|
||||||
|
c, err := pkg.Open(b.Context(), msg, 0, 0, 0, check.MustAbs(b.TempDir()))
|
||||||
|
if err != nil {
|
||||||
|
b.Fatal(err)
|
||||||
|
}
|
||||||
|
_, _, err = c.Cure(earlyFailureF(8))
|
||||||
|
if !errors.Is(err, stub.UniqueError(0xcafe)) {
|
||||||
|
b.Fatalf("Cure: error = %v", err)
|
||||||
|
}
|
||||||
|
c.Close()
|
||||||
|
|
||||||
|
for b.Loop() {
|
||||||
|
err.Error()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestDependencyCureErrorEarly(t *testing.T) {
|
func TestDependencyCureErrorEarly(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user