Skip to content

perf(engine): pass process arguments as arrays - #15709

Open
rgrinberg wants to merge 1 commit into
ocaml:mainfrom
rgrinberg:push-wzlznyorsmov
Open

perf(engine): pass process arguments as arrays#15709
rgrinberg wants to merge 1 commit into
ocaml:mainfrom
rgrinberg:push-wzlznyorsmov

Conversation

@rgrinberg

@rgrinberg rgrinberg commented Aug 7, 2026

Copy link
Copy Markdown
Member

Expanded action arguments are currently flattened into a list, retaining one list cell per argument while the subprocess runs and allocating a temporary reversed list during flattening.

Flatten action arguments directly into an immutable array and use arrays as the canonical representation in the process core. Existing list-based Process entry points convert at their boundary, while command rendering converts only when needed. Trace events consume arrays directly without changing the serialized format, and process runner requests retain arrays across marshalling.

Spawn.spawn accepts the executable, argv[0], and the remaining immutable argument array separately. This preserves caller control over argv[0] while allowing the Unix stub to construct the C argument vector without first materializing either an OCaml argument list or a second full argv array.

Across six alternating cold @check build pairs with eight jobs and the cache disabled, median minor allocation fell from 295.99M to 295.57M words (-0.14%), promoted allocation fell from 45.30M to 44.34M words (-2.12%), and major allocation fell from 102.13M to 101.27M words (-0.84%). In a separate six-pair --action-runner comparison, retaining arrays in runner requests saved another 0.42M parent-process minor words. Runtime measurements remained noisy.

@rgrinberg
rgrinberg force-pushed the push-wzlznyorsmov branch 4 times, most recently from c6fb2f9 to 976d67e Compare August 8, 2026 21:25
@rgrinberg rgrinberg changed the title perf(engine): pass action arguments to spawn as arrays perf(engine): pass process arguments as arrays Aug 8, 2026
@rgrinberg
rgrinberg force-pushed the push-wzlznyorsmov branch 5 times, most recently from e13ce15 to 0a110c3 Compare August 9, 2026 12:40
Flatten expanded action arguments directly into an immutable array and use arrays as the canonical representation throughout process execution. Existing list-based Process entry points convert at their boundary, while command rendering converts only when needed. Trace events consume arrays directly without changing the serialized format, and process runner requests retain arrays across marshalling.

Spawn accepts the executable, argv[0], and the remaining immutable argument array separately. This preserves caller control over argv[0] while letting the Unix stub construct the C argument vector without materializing either an OCaml argument list or a second full argv array.

Across six alternating cold @check build pairs with eight jobs and the cache disabled, median minor allocation fell from 295.99M to 295.57M words (-0.14%), promoted allocation fell from 45.30M to 44.34M words (-2.12%), and major allocation fell from 102.13M to 101.27M words (-0.84%). In a separate six-pair --action-runner comparison, retaining arrays in runner requests saved another 0.42M parent-process minor words. Runtime measurements remained noisy.

Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant