Skip to content

vm: lazily initialize primordials for vm contexts

Lazily initialize primordials when cross-context support for builtins is needed to fix the performance regression in context creation.

Fixes: https://github.com/nodejs/node/issues/29842

local benchmark results

                            confidence improvement accuracy (*)    (**)   (***)
 vm/create-context.js n=100        ***    485.26 %      ±15.48% ±21.32% ±29.29%
Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

Merge request reports

Loading