~/talk

A Fast Structured Logging Package

Talkat GopherCon Europe 2023 · 2023-06-26..06-29· [go]
slides:none on file

New structured logging package slog for Go 1.21 aims for zap-level speed and exposes a concrete Logger plus a more-complex Handler API that enables backend optimizations. Benchmarks run in parallel and use benchstat; typical calls use 5 attributes (captures ~95%) and ~8 constructors (95%). Fast path is log.Adders (avoids variadic slice heap alloc), records copy-by-value with an inline array sized 5 to avoid allocations, uses unsafe string data packing to eliminate interface boxing, and deliberately avoids sync.Pool to prevent use-after-free.

AI-written summary · about

  1. 0:00Introduction
  2. 1:23slog API demo
  3. 2:47Why slog needed speed
  4. 4:13Performance goals
  5. 5:38Logging patterns analysis
  6. 7:04Concurrent logging benchmarks
  7. 9:12Handler architecture
  8. 11:58Avoiding indirect calls
  9. 13:00Heap vs stack trade-offs
  10. 15:05Variadic args and escape analysis
  11. 16:51Byte slice optimizations
  12. 17:53sync.Pool for zero allocations
  13. 18:41Passing records by value
  14. 19:28Preallocating attribute arrays
  15. 21:14slog.value optimizations
  16. 22:42Zero-allocation values
  17. 24:47Design lessons
  18. 25:30Summary
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.