aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/pkg/pkg_test.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-05-12 18:59:25 +0900
committerOphestra <cat@gensokyo.uk>2026-05-12 18:59:25 +0900
commita6008ef68b38d044e2082f1ad0475849ea098b49 (patch)
tree2e7d8f142ae4cbca035258554aeed9f2181b65b9 /internal/pkg/pkg_test.go
parent5228b2736237b98ca9ec3c75d2bacf058dcf905c (diff)
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>
Diffstat (limited to 'internal/pkg/pkg_test.go')
-rw-r--r--internal/pkg/pkg_test.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/internal/pkg/pkg_test.go b/internal/pkg/pkg_test.go
index 060dea6d..3df040d2 100644
--- a/internal/pkg/pkg_test.go
+++ b/internal/pkg/pkg_test.go
@@ -1603,6 +1603,24 @@ func (a earlyFailureF) Cure(*pkg.FContext) error {
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) {
t.Parallel()