~/talk

Blazing Fast Merge with Loser Trees

Talkat GopherCon UK 2024 · 2024-08-14..08-16· [go]
slides:none on file

Implements a loser tree k‑way merge in Go using Go generics to remove interface dispatch and speed the inner loop; replaces heap-based merging and gets about 4–8× faster on a Prometheus postings benchmark while using ~4.5MB extra for 100k items. Integrates into Loki for logs (30% end-to-end improvement, one component 4× faster). Problems: push‑style go1.23 iterators force heavy allocations, and Go’s current devirtualization/profile‑guided optimization is incomplete so performance depends on compiler support.

AI-written summary · about

  1. 0:00Introduction
  2. 1:07Algorithms in real systems
  3. 2:58Heap performance bottleneck
  4. 6:37K-way merge problem
  5. 8:27Loser tree algorithm
  6. 13:28Complexity and performance
  7. 15:38Generics implementation
  8. 21:21Core loop
  9. 23:10Benchmarking in Prometheus
  10. 26:05Log merging in Loki
  11. 28:35Generics limitations
  12. 31:54Loki with function params
  13. 32:59Compiler optimizations
  14. 35:50Go 1.23 iterators
  15. 37:15Rewriting with iterators
  16. 40:24Benchmarking iterator version
  17. 41:50Loki performance
  18. 42:32Summary
  19. 43:19Q&A
~/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.