Cache runtime version metadata fallback

This commit is contained in:
2026-10-09 01:46:07 +00:00
parent 50d3573257
commit 42569b4af2
5 changed files with 94 additions and 4 deletions

View File

@@ -18,7 +18,19 @@ func BenchmarkPerformanceVersion(b *testing.B) {
}
}
})
b.Run("FallbackInitialization", func(b *testing.B) {
b.ReportAllocs()
b.ResetTimer()
for i := 0; i < b.N; i++ {
fallback := newFallbackVersion(debug.ReadBuildInfo)
performanceVersionSink = fallback()
if performanceVersionSink == "" {
b.Fatal("fallback returned an empty version")
}
}
})
b.Run("RealMetadataFallback", func(b *testing.B) {
_ = Version()
b.ReportAllocs()
b.ResetTimer()
for i := 0; i < b.N; i++ {