I was only explaining how busybox does not do what the previous commenter thought.
The authors entire point about sort was to show just how little it's speed matters, because the job is rarely 90% within sort, or any other util like that (I don't count awk because awk is a fully functional language like sh, you could do the entire job in awk). How fast sort sorts 100 lines of text doesn't matter next to the cost of forking to execute sort, especially if it will happen repeatedly to do small jobs, treating it like a function.
The reason it's bad is that there are so many and so small such things, and it adds up, and the shell is specifically designed to hide the cost of forking a process by making keywords and executables indistiguishable. And so you end up with a zillion forks just to get the current time or to strip a few bytes off of a few bytes long string, or even to do nothing but simply store a value in a variable (date, basename/dirname, foo=`generatefoo`)
Sure, that doesn't mean don't use sh, nor does it mean do the contortions necessary to write in sh but avoid that problem, all that means is don't write non-trivial apps in sh. ... well unless you need the ubiquity more than the performance or readability. So it doesn't even necessarily mean that automatically.
temp files - It would make no sense in most cases to go through pains to avoid forks only to use temp files instead. Creating and destroying a file, even in tmpfs(ram), is as bad or maybe even worse than a process.
{} - I didn't forget {}, it had no special bearing on an explaination of what the author was talking about that makes shell scripts slow, and why busybox does not change that. It's just a branching structure like any other.
I was only explaining how busybox does not do what the previous commenter thought.
The authors entire point about sort was to show just how little it's speed matters, because the job is rarely 90% within sort, or any other util like that (I don't count awk because awk is a fully functional language like sh, you could do the entire job in awk). How fast sort sorts 100 lines of text doesn't matter next to the cost of forking to execute sort, especially if it will happen repeatedly to do small jobs, treating it like a function.
The reason it's bad is that there are so many and so small such things, and it adds up, and the shell is specifically designed to hide the cost of forking a process by making keywords and executables indistiguishable. And so you end up with a zillion forks just to get the current time or to strip a few bytes off of a few bytes long string, or even to do nothing but simply store a value in a variable (date, basename/dirname, foo=`generatefoo`)
Sure, that doesn't mean don't use sh, nor does it mean do the contortions necessary to write in sh but avoid that problem, all that means is don't write non-trivial apps in sh. ... well unless you need the ubiquity more than the performance or readability. So it doesn't even necessarily mean that automatically.
temp files - It would make no sense in most cases to go through pains to avoid forks only to use temp files instead. Creating and destroying a file, even in tmpfs(ram), is as bad or maybe even worse than a process.
{} - I didn't forget {}, it had no special bearing on an explaination of what the author was talking about that makes shell scripts slow, and why busybox does not change that. It's just a branching structure like any other.