The Cost of Forking External Commands

Updated

October 31, 2026

The Cost of Forking External Commands

Forking an external command (like expr or date) inside a loop takes ~1-2ms per invocation. In a loop of 10,000 iterations, forking adds 15+ seconds of overhead!