mirror of
https://github.com/stablyai/orca.git
synced 2026-11-16 02:47:34 +00:00
NODE_COMPILE_CACHE only stores what V8 compiles before a script runs: 5.4 MB of orcad-server.js's 15 MB. Every function startup runs still compiled lazily on every boot. Measured on a VM from golden snap_aQmW, orcad ready went from 0.95-1.06 s to 0.70-0.78 s (5 pairs, alternated), and from ~1.25 s to ~0.95 s on a slower host. image/vm/orcad-boot runs orcad-server.js through a vm.Script whose code cache is taken as the image's smoke run exits, so it covers what startup compiled. orcad sees the same argv, __filename, require and import() resolution as under plain node. The cache file starts with a header (Node version, arch, bundle length and crc32): V8 itself only checks the source length, so a cache from other bundle bytes would otherwise run stale code. Without a matching cache orcad loads through require exactly as before. Verified in that VM: the cache is accepted, the experimental-loader warning stays out of orcad.log, and a terminal created through the CLI runs (node-pty resolves via import() from the bundle directory).