~/talk

Parsing JavaScript - better lazy than eager?

Talkat JSConf EU 2017 · on Sunday, 2017-05-07· [javascript]
slides:none on file

V8 uses an eager parser for top-level code and a fast pre-parser ~2x faster for lazy functions, trading full AST/scope work for speed; mobile parsing averages ≈1 MB/s and real pages spend 15–20% of V8 time (≈370 ms) parsing at startup. Streaming and code cache speed script load but a single large bundle invalidates cache for small updates; nested functions force context allocation and cause repeated reparsing of inner functions, and forcing eager parse with the parens hack or optimize-just sometimes fixes startup latency.

AI-written summary · about

  1. 0:00Intro
  2. 1:01Parsing
  3. 4:05Why should you care
  4. 4:52Parsing modes
  5. 6:05Parse example
  6. 7:02Other heuristics
  7. 7:19Lazy vs eager cases
  8. 8:26Why lazy parsing
  9. 9:38Force eager parsing
  10. 10:20Function context allocation
  11. 11:53Lazy parsing with names
  12. 12:55Lazy parsing with nested functions
  13. 14:13Why is parsing hard
  14. 16:11A typical parser bug
  15. 17:55Benchmarking
  16. 19:43What can you do
  17. 20:51Code Cache
  18. 21:36Streaming
  19. 22:12Evolve
  20. 22:56Bonus Content
~/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.