Files
scriptc/packages
Malte Ubl 5f12a16f8b Switch fibers with a register-only context swap
On x86_64 and AArch64 POSIX targets, fiber switches now save and restore
only the ABI's callee-saved state (scr_ctx_swap) instead of going through
swapcontext/getcontext/makecontext. swapcontext saves and restores the
process signal mask on every switch: one rt_sigprocmask syscall on glibc,
and sigprocmask + sigaltstack + getrlimit on Darwin, plus a 16 KiB memset
in Darwin's makecontext per spawn. Those dominated await-heavy programs
(async-pipeline: most samples in sigprocmask/__sigaltstack/__getrlimit on
macOS, 0.11 s of 0.23 s in the kernel on Linux). The runtime never uses a
context to change the signal mask. Other POSIX targets keep ucontext;
Windows and WASI are unchanged. The sanitizer fiber annotations wrap the
new switch exactly as they wrapped swapcontext.

The spare fiber-stack pool grows from 4 to 64 entries. With fan-out
(Promise.all over a few batches) finished and new fibers alternate in
waves wider than 4, so most spawns paid an mmap, a munmap, and fresh-page
faults. Spares are still unmapped before the loop sleeps.
2026-10-08 15:22:27 -05:00
..
2026-10-08 11:00:13 -05:00
2026-10-07 19:15:55 -05:00
2026-10-07 19:15:55 -05:00
2026-10-07 19:15:55 -05:00
2026-10-07 19:15:55 -05:00
2026-10-07 19:15:55 -05:00
2026-10-07 19:15:55 -05:00
2026-10-07 19:15:55 -05:00
2026-10-07 19:15:55 -05:00
2026-10-07 19:15:55 -05:00
2026-10-07 19:15:55 -05:00
2026-10-07 19:15:55 -05:00
2026-10-07 19:15:55 -05:00
2026-10-07 19:15:55 -05:00
2026-10-07 19:15:55 -05:00