From: Michael Anthony Knyszek Date: Wed, 19 Nov 2025 03:37:09 +0000 (+0000) Subject: runtime/trace: add Log benchmark X-Git-Tag: go1.26rc1~175 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=8d9906cd34;p=gostls13.git runtime/trace: add Log benchmark This is a pretty decent benchmark of the baseline event cost. Change-Id: I22a7fa3411bd80be3bd8093d5933e29062cb1377 Reviewed-on: https://go-review.googlesource.com/c/go/+/723060 Reviewed-by: Michael Pratt LUCI-TryBot-Result: Go LUCI --- diff --git a/src/runtime/trace/annotation_test.go b/src/runtime/trace/annotation_test.go index 3bd767bfbe..ea10843230 100644 --- a/src/runtime/trace/annotation_test.go +++ b/src/runtime/trace/annotation_test.go @@ -6,6 +6,7 @@ package trace_test import ( "context" + "io" . "runtime/trace" "testing" ) @@ -34,3 +35,15 @@ func BenchmarkNewTask(b *testing.B) { } }) } + +func BenchmarkLog(b *testing.B) { + b.ReportAllocs() + + Start(io.Discard) + defer Stop() + + ctx := context.Background() + for b.Loop() { + Log(ctx, "", "") + } +}