(Being included in the code cache increases both the footprint on the hard disk and takes longer to serialize and deserialize. let alone the memory…) - So only the toplevel code gets compiled - Functions contained is compiled until the function is actually called - Lazily compiling inner functions still requires a new parsing pass
Bytecode size have a small memory footprint (machine code generated by V8’s full- codegen compiler is verbose) • … so that we always compile it eagerly • … so that initial startup is faster
hold temporary results • avoiding the need to specify specific register operands, reduces the size of bytecodes • many JavaScript expressions involve chains of operations
network resources. • FE usually won’t ship a lot of unused code • BE has big node_modules folder so cost of eagerly compiling all is still huge • BE has mmap, though…mmap works good on a single file, though…
node_modules • Put them inside a SquashFS (i.e. your.exe) • Mmap SquashFS (i.e. your.exe) when executed • Enjoy low memory footprint AND fast startup, while avoiding multiple parsings, even no source shipped • End-product got bigger. Who cares? (this is not FE)