~/talk

Processing One Billion Rows in PHP

Talkat phpday 2025 · 2025-05-15..05-16· [php]
slides:none on file

The talk shows a concrete path from a naive PHP script that takes ~25 minutes on 1B rows to a production-ish solution under 13 seconds: replace fgetcsv with line parsing, cast temperatures to floats, avoid repeated hashmap lookups, enable opcache_enable_cli and JIT (7m19s), then split the file into byte-aligned chunks and run workers with the parallel extension (1m35s → 27.7s with an optimized build → 12.7s after stream_get_line and string-copy reductions).

AI-written summary · about

  1. 0:00Introduction
  2. 1:281 billion row challenge overview
  3. 3:38Challenge rules
  4. 6:05Naive PHP solution
  5. 8:54Profiling initial solution
  6. 10:18Optimizing with fgets
  7. 12:50Reducing hashmap lookups
  8. 15:42Simplifying comparisons
  9. 17:08Fixing type juggling
  10. 19:41OPcache for CLI
  11. 21:05Parallel processing
  12. 27:47Debug vs optimized builds
  13. 29:18Final runtime
  14. 31:03Bonus optimizations
  15. 34:34Key takeaways
~/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.