3 ms·
> every command you run in a script is basically a fork Not for built-in commands. > Yeah “fork is slow” is the sort of microbenchmark that is mostly irreleva
by dataflow 5y ago
> every command you run in a script is basically a fork
Not for built-in commands.
> Yeah “fork is slow” is the sort of microbenchmark that is mostly irrelevant for shell scripts
Maybe if you're on a Linux kernel, but not everywhere else.
- Spivak 5y agoWhere are you running bash where forks are expensive? Like sure Windows exists but bash on WSL is running a Linux kernel.
- chasil 5y agoWhen I am using busybox sh/bash, I am very, very careful not to fork unless I must. For mass processing, I will use xargs to minimize the number of processes created.
- dataflow 5y agoNot quite. WSL2 uses a Linux kernel. WSL1 uses a Windows kernel and fork is much slower there. Also there's userspace variants like MSYS2, Cygwin, etc.