Commit dc41c13
src: reduce unnecessary serialization of CLI options in C++
In this patch we split the serialization routine into two different
routines: `getCLIOptionsValues()` for only serializing the key-value
pairs and `getCLIOptionsInfo()` for getting additional information such
as help text etc. The former is used a lot more frequently than the
latter, which is only used for generating `--help` and building
`process.allowedNodeEnvironmentFlags`.
`getCLIOptionsValues()` also adds `--no-` entries for boolean options so
there is no need to special case in the JS land.
This patch also refactors the option serialization routines to
use v8::Object constructor that takes key-value pairs in one go
to avoid calling Map::Set or Object::Set repeatedly which can go
up to a patched prototype.
PR-URL: #52451
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>1 parent fb24c44 commit dc41c13Copy full SHA for dc41c13
File tree
Expand file treeCollapse file tree
6 files changed
+183
-139
lines changedOpen diff view settings
Filter options
- lib/internal
- main
- process
- src
- test/parallel
Expand file treeCollapse file tree
6 files changed
+183
-139
lines changedOpen diff view settings
Collapse file
lib/internal/main/print_help.js
Copy file name to clipboardExpand all lines: lib/internal/main/print_help.js+5-2Lines changed: 5 additions & 2 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
24 | 24 | |
25 | 25 | |
26 | 26 | |
| 27 | + |
| 28 | + |
27 | 29 | |
28 | 30 | |
29 | 31 | |
| ||
134 | 136 | |
135 | 137 | |
136 | 138 | |
137 | | - |
| 139 | + |
138 | 140 | |
139 | 141 | |
| 142 | + |
140 | 143 | |
141 | 144 | |
142 | 145 | |
| ||
198 | 201 | |
199 | 202 | |
200 | 203 | |
201 | | - |
| 204 | + |
202 | 205 | |
203 | 206 | |
204 | 207 | |
|
Collapse file
+16-36Lines changed: 16 additions & 36 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
1 | 1 | |
2 | 2 | |
3 | 3 | |
4 | | - |
5 | | - |
6 | | - |
7 | | - |
8 | | - |
| 4 | + |
| 5 | + |
9 | 6 | |
10 | 7 | |
11 | 8 | |
12 | 9 | |
13 | 10 | |
14 | | - |
15 | | - |
| 11 | + |
| 12 | + |
16 | 13 | |
17 | 14 | |
18 | | - |
| 15 | + |
19 | 16 | |
20 | 17 | |
21 | 18 | |
22 | 19 | |
23 | | - |
24 | | - |
| 20 | + |
| 21 | + |
25 | 22 | |
26 | | - |
| 23 | + |
27 | 24 | |
28 | 25 | |
29 | | - |
30 | | - |
31 | | - |
| 26 | + |
| 27 | + |
| 28 | + |
32 | 29 | |
33 | | - |
| 30 | + |
34 | 31 | |
35 | 32 | |
36 | 33 | |
| ||
41 | 38 | |
42 | 39 | |
43 | 40 | |
44 | | - |
45 | | - |
| 41 | + |
46 | 42 | |
47 | 43 | |
48 | 44 | |
49 | | - |
50 | | - |
51 | | - |
52 | | - |
53 | | - |
54 | | - |
55 | | - |
56 | | - |
57 | | - |
58 | | - |
59 | | - |
60 | | - |
61 | | - |
| 45 | + |
| 46 | + |
62 | 47 | |
63 | 48 | |
64 | 49 | |
| ||
76 | 61 | |
77 | 62 | |
78 | 63 | |
79 | | - |
80 | | - |
81 | | - |
82 | | - |
83 | | - |
84 | | - |
| 64 | + |
85 | 65 | |
86 | 66 | |
87 | 67 | |
|
Collapse file
lib/internal/process/per_thread.js
Copy file name to clipboardExpand all lines: lib/internal/process/per_thread.js+2-1Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
284 | 284 | |
285 | 285 | |
286 | 286 | |
287 | | - |
| 287 | + |
| 288 | + |
288 | 289 | |
289 | 290 | |
290 | 291 | |
|
0 commit comments