Commit daecfc0
authored
child_process: pass spawn options to the binding positionally
ChildProcess.prototype.spawn() handed a single options object to the
ProcessWrap::Spawn() binding, which then read about a dozen properties
back out individually with Object::Get(). Each of those is a property
lookup across the JS/C++ boundary on every spawn.
Pass file, args, cwd, envPairs, stdio, uid and gid as positional
arguments and pack the boolean flags (detached, windowsHide,
windowsVerbatimArguments) into a single integer whose bit values are
exported from the binding as `constants`. The native side then reads
each value directly from the call arguments.
Add internal typings for the process_wrap binding (previously untyped)
describing the new positional spawn() signature and the exported
constants.
There is no observable behavior change. Spawn wall-clock time is
dominated by the operating system process-creation cost and is
unchanged; this reduces the per-spawn work done on the main thread and
clarifies the contract between the JS and C++ layers.
Signed-off-by: Yagiz Nizipli <yagiz@nizipli.com>
PR-URL: #63930
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Daniel Lemire <daniel@lemire.me>1 parent 5e0969a commit daecfc0
4 files changed
Lines changed: 102 additions & 76 deletions
File tree
- lib/internal
- src
- typings
- internalBinding
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
| 44 | + | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| |||
397 | 397 | | |
398 | 398 | | |
399 | 399 | | |
400 | | - | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
401 | 418 | | |
402 | 419 | | |
403 | 420 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| 52 | + | |
52 | 53 | | |
53 | 54 | | |
54 | 55 | | |
55 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
56 | 64 | | |
57 | 65 | | |
58 | 66 | | |
| |||
71 | 79 | | |
72 | 80 | | |
73 | 81 | | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
74 | 88 | | |
75 | 89 | | |
76 | 90 | | |
| |||
118 | 132 | | |
119 | 133 | | |
120 | 134 | | |
121 | | - | |
| 135 | + | |
122 | 136 | | |
123 | 137 | | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | 138 | | |
130 | 139 | | |
131 | 140 | | |
| |||
188 | 197 | | |
189 | 198 | | |
190 | 199 | | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | 200 | | |
198 | 201 | | |
199 | 202 | | |
200 | 203 | | |
201 | 204 | | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
209 | 208 | | |
210 | 209 | | |
211 | 210 | | |
212 | 211 | | |
213 | 212 | | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
| 213 | + | |
| 214 | + | |
219 | 215 | | |
220 | 216 | | |
221 | 217 | | |
222 | 218 | | |
223 | 219 | | |
224 | 220 | | |
225 | 221 | | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
| 222 | + | |
| 223 | + | |
231 | 224 | | |
232 | 225 | | |
233 | 226 | | |
| |||
244 | 237 | | |
245 | 238 | | |
246 | 239 | | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
| 240 | + | |
252 | 241 | | |
253 | 242 | | |
254 | | - | |
255 | | - | |
| 243 | + | |
| 244 | + | |
256 | 245 | | |
257 | 246 | | |
258 | 247 | | |
| |||
273 | 262 | | |
274 | 263 | | |
275 | 264 | | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
| 265 | + | |
281 | 266 | | |
282 | | - | |
| 267 | + | |
283 | 268 | | |
284 | 269 | | |
285 | 270 | | |
286 | 271 | | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
| 272 | + | |
292 | 273 | | |
293 | 274 | | |
294 | | - | |
295 | | - | |
| 275 | + | |
| 276 | + | |
296 | 277 | | |
297 | 278 | | |
298 | 279 | | |
| |||
313 | 294 | | |
314 | 295 | | |
315 | 296 | | |
316 | | - | |
| 297 | + | |
317 | 298 | | |
318 | | - | |
| 299 | + | |
319 | 300 | | |
320 | 301 | | |
321 | 302 | | |
322 | 303 | | |
323 | 304 | | |
324 | | - | |
325 | | - | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | | - | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
330 | 308 | | |
331 | | - | |
| 309 | + | |
332 | 310 | | |
333 | 311 | | |
334 | 312 | | |
335 | 313 | | |
336 | 314 | | |
337 | 315 | | |
338 | 316 | | |
339 | | - | |
340 | | - | |
341 | | - | |
342 | | - | |
343 | | - | |
344 | | - | |
345 | | - | |
346 | | - | |
| 317 | + | |
347 | 318 | | |
348 | 319 | | |
349 | 320 | | |
350 | | - | |
351 | | - | |
352 | | - | |
353 | | - | |
354 | | - | |
355 | | - | |
356 | | - | |
357 | | - | |
| 321 | + | |
358 | 322 | | |
359 | 323 | | |
360 | 324 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
55 | 56 | | |
56 | 57 | | |
57 | 58 | | |
| 59 | + | |
58 | 60 | | |
59 | 61 | | |
60 | 62 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
0 commit comments