github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/log/slog/internal/benchmarks/benchmarks.go (about) 1 // Copyright 2023 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // Package benchmarks contains benchmarks for slog. 6 // 7 // These benchmarks are loosely based on github.com/uber-go/zap/benchmarks. 8 // They have the following desirable properties: 9 // 10 // - They test a complete log event, from the user's call to its return. 11 // 12 // - The benchmarked code is run concurrently in multiple goroutines, to 13 // better simulate a real server (the most common environment for structured 14 // logs). 15 // 16 // - Some handlers are optimistic versions of real handlers, doing real-world 17 // tasks as fast as possible (and sometimes faster, in that an 18 // implementation may not be concurrency-safe). This gives us an upper bound 19 // on handler performance, so we can evaluate the (handler-independent) core 20 // activity of the package in an end-to-end context without concern that a 21 // slow handler implementation is skewing the results. 22 // 23 // - We also test the built-in handlers, for comparison. 24 package benchmarks