A deep-dive into a performance bottleneck discovered in oxlint and oxfmt when run on codebases with many directories. The root cause was excessive syscalls during config file discovery: each `.is_file()` call triggers a full kernel context switch, and with 150k sequential calls across 50k directories, this created massive latency. The fix replaces individual `is_file()` checks with `readdir`-based traversal, which returns filenames and file types for free without extra syscalls. Additionally, the two-phase approach (config discovery then linting) was fused into a single traversal pass. The result is a ~50% speedup (6.1s → 2.8s) for large projects with many directories.

6m read timeFrom marvinh.dev
Post cover image
Table of contents
Why are you idling, CPU?The syscall ghostZero cost discovery with readdirGetting rid of phasesRemember: Syscalls are expensive
5 Comments

Sort: