4 ms·
What all those "ridiculous" tools allow, among other things, is: - Cheap parallelism. Things as easy as `grep | cut | sort` will utilize multiple cores despite
by vthriller 7y ago
What all those "ridiculous" tools allow, among other things, is:
- Cheap parallelism. Things as easy as `grep | cut | sort` will utilize multiple cores despite shell and all the tools it spawns being single-threaded. I can't imagine threading primitives in some supercharged version of bash without some ugly syntax and a number of additional questions about deadlocks on StackOverflow. That would not be bash, but some ugly Python parody instead. (Also note that even PowerShell seems to limit itself to job control primitives despite being more capable .NET-backed language: [1].) That usually saves me much more than ability of zsh to multiply floating point numbers without forking.
- (Inter)changeability. Want to multiply complex numbers? Use another calc. Want ridiculous regexes? pcregrep. Want to scan large hard disk efficiently? ffcnt [2]. Want to do something else, and to do it efficiently? Write a program without spending a time to learn your shell's C API [3], just read stdin or parse argv. Yeah, I too wish to not spend much time serializing and deserializing data in each and every pipe, but that would require not a new shell (we already have PowerShell) but, I guess, an entirely new OS as well as ecosystem designed just for that OS, which nobody would spend much time adapting to at this time.
[1] https://stackoverflow.com/questions/3325911/how-does-threading-in-powershell-work https://stackoverflow.com/questions/3325911/how-does-threadi...
[2] https://github.com/the8472/ffcnt https://github.com/the8472/ffcnt
[3] Really, who got time to spend on something like https://docs.python.org/2/c-api/index.html https://docs.python.org/2/c-api/index.html (I know, Cython exists, but there's no Cython for every language out there.)
(edit: formatting; replaced platter-walk (which is a library) with ffcnt (which uses said library))