node icon indicating copy to clipboard operation
node copied to clipboard

lib: make navigator properties lazy

Open jasnell opened this issue 1 year ago • 1 comments

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: image

After: image

jasnell avatar Jun 30 '24 07:06 jasnell

Review requested:

  • [ ] @nodejs/web-standards

nodejs-github-bot avatar Jun 30 '24 07:06 nodejs-github-bot

CI: https://ci.nodejs.org/job/node-test-pull-request/60035/

nodejs-github-bot avatar Jul 03 '24 19:07 nodejs-github-bot

CI: https://ci.nodejs.org/job/node-test-pull-request/60054/

nodejs-github-bot avatar Jul 04 '24 03:07 nodejs-github-bot

Landed in 8040994ea9079c7a7b1ecd43ac3ba143bf3b5f46

nodejs-github-bot avatar Jul 04 '24 14:07 nodejs-github-bot