Skip to content

src: use v8::Isolate::GetDefaultLocale() to compute navigator.language

src: use v8::Isolate::GetDefaultLocale() to compute navigator.language

Using the Intl API to get the default locale slows down the startup significantly. This patch uses a new v8 API to get the default locale directly.

Refs: https://github.com/nodejs/node/pull/53765#issuecomment-2276802345

First commit comes from https://chromium-review.googlesource.com/c/v8/v8/+/5772938

From benchmark CI:

https://ci.nodejs.org/view/Node.js%20benchmark/job/benchmark-node-micro-benchmarks/1594/console

14:54:15                                                                                           confidence improvement accuracy (*)   (**)  (***)
14:54:15 misc/startup-core.js count=30 mode='process' script='benchmark/fixtures/require-builtins'        ***     18.60 %       ±0.30% ±0.41% ±0.54%
14:54:15 misc/startup-core.js count=30 mode='process' script='test/fixtures/semicolon'                    ***     25.02 %       ±2.92% ±3.93% ±5.19%
14:54:15 misc/startup-core.js count=30 mode='process' script='test/fixtures/snapshot/typescript'          ***      4.32 %       ±0.04% ±0.06% ±0.07%
14:54:15 misc/startup-core.js count=30 mode='worker' script='benchmark/fixtures/require-builtins'                 -0.05 %       ±0.18% ±0.24% ±0.31%
14:54:15 misc/startup-core.js count=30 mode='worker' script='test/fixtures/semicolon'                              0.02 %       ±0.36% ±0.47% ±0.62%
14:54:15 misc/startup-core.js count=30 mode='worker' script='test/fixtures/snapshot/typescript'            **     -1.48 %       ±0.87% ±1.16% 

Merge request reports

Loading