~/talk

Big O in a Homemade Hash

Talkat MountainWest RubyConf 2014 · 2014-03-20..03-21· [ruby]
slides:none on file

Builds a Hash class from scratch, first as a naive tuple_map that shows linear lookup, then replaces it with a sparse array plus a digest function and buckets, measuring reads that stay flat and writes with occasional rehash spikes (one spike reaches ~48s against millions of entries). Growth policy is grow when bucket has 10 keys, resizing by double size and next prime and rehashing everything, yielding amortized O(1) performance but not production‑tuned compared to Ruby's native C implementation.

AI-written summary · about

  1. 0:00Intro
  2. 0:41What is a Hash
  3. 1:36Hash Clasp
  4. 2:10Syntax
  5. 2:31Testing
  6. 2:49Phone call
  7. 3:20The problem
  8. 3:47Big O notation
  9. 4:45Order of growth
  10. 7:18The Traveling Salesman problem
  11. 9:57The Big O problem
  12. 10:32Measurement
  13. 11:11Internals
  14. 11:34RAM
  15. 12:46New Plan
  16. 14:08Collisions
  17. 14:31Buckets
  18. 14:57Waste
  19. 15:25Memory for speed
  20. 15:51Trade off RAM
  21. 16:05Grow as needed
  22. 16:21Spread things out
  23. 16:50Rehash every key
  24. 17:07Basic strategy
  25. 17:26Modulo
  26. 18:29Growth Strategy
  27. 19:03Number Conversion
  28. 19:29Same Value
  29. 21:07Review
  30. 21:38Performance
  31. 22:05Graph
  32. 23:14Spikes
  33. 23:31Native Hash
  34. 24:14Linear Performance
  35. 25:01Success
  36. 25:35Growth
  37. 26:44Email
  38. 27:34Applications
  39. 28:31Adding Servers
  40. 29:14President Obama
  41. 29:35Outbox
~/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.