From 8d9906cd34a1052868c1c0273e6f2d22632e0e84 Mon Sep 17 00:00:00 2001 From: Michael Anthony Knyszek Date: Wed, 19 Nov 2025 03:37:09 +0000 Subject: [PATCH] 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 --- src/runtime/trace/annotation_test.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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, "", "") + } +} -- 2.52.0