• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pantsbuild / pants / 28692728896

04 Jul 2026 02:54AM UTC coverage: 92.83% (-0.001%) from 92.831%
28692728896

push

github

web-flow
Permit vfork fast-path within local `execute_process` (#23466)

Replaces use of `tokio::process::Command::pre_exec()` to establish a new
process group for the spawned child instead with
`tokio::proces::Command::process_group()`, as the former requires a
"slow" `fork -> (pre_exec closures)* -> exec` codepath, and the latter
permits a `vfork -> exec`-based fast-path.

This improves local build performance relative to both the resident set
size that the Pants process builds up (i.e. through in-memory caching of
rule results), and to the number of processes spawned through
`execute_process()`.

The "slow" path translates to underlying `clone()` syscalls without the
`CLONE_VFORK|CLONE_VM` flags, which suffer latency relative to the
parent process resident set size due to duplication of page tables for
the child, a cost which can become considerable for parent processes
(i.e., `pants`) that have allocated significant memory (e.g., cached
rule results), and can become meaningful for local Pants builds spawning
many processes.

This change permits the runtime to take the "fast" `vfork`-based path
(using `clone()` with `CLONE_VFORK|CLONE_VM`), which has ~constant
latency irrespective of parent memory allocation. "Permits", because
this code change alone does not ensure the fast path is taken;
minimally, the environment must also supply a glibc v2.29+, the earliest
version providing another required ingredient for taking the `vfork`
fast path (`posix_spawn_file_actions_addchdir_np()`).

93795 of 101040 relevant lines covered (92.83%)

3.7 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

96.15
/src/python/pants/backend/tools/preamble/subsystem.py


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc