node
node copied to clipboard
lib: make navigator properties lazy
Noticed in some benchmarking/profiling that the Navigator object constructor was rather expensive and slow due to initialization of properties during construction. It makes more sense for these to be lazily initialized on first access.
Flamegraphs... of `node -pe "navigator"
Before:
After:
Review requested:
- [ ] @nodejs/web-standards
CI: https://ci.nodejs.org/job/node-test-pull-request/60035/
CI: https://ci.nodejs.org/job/node-test-pull-request/60054/
Landed in 8040994ea9079c7a7b1ecd43ac3ba143bf3b5f46