~/talk

Common Patterns for Bounds Check Elimination

Talkat GopherCon 2020 · 2020-11-09..11-13· [go]
slides:none on file

Shows concrete patterns that let the Go compiler drop bounds checks and measurably speed code: use dummy access to move checks outside loops, reslice to fixed length when an index contains a variable, and move check outside loop for sequential indices; exploit known ranges (byte = 0–255). Demonstrates on a Levenshtein implementation, cutting bounds checks from seven to one and getting 17–27% faster (≈22% average). Uses the compiler’s diagnostics that print “found is inbounds” to verify each change and stresses benchmarking and readability tradeoffs.

AI-written summary · about

  1. 0:00Introduction
  2. 5:10Bounce Check
  3. 7:49Common Patterns
  4. 12:11Demo
  5. 17:48Things to keep in mind
  6. 18:52Outro
~/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.