5 ms·
Indeed, I don't see why people get so upset (or pedantic) about what are, effectively, NOPs in command-lines. However, things change if you start adding certai
by alexfoo 14y ago
Indeed, I don't see why people get so upset (or pedantic) about what are, effectively, NOPs in command-lines.
However, things change if you start adding certain options to sort:-
sort -m order.*
and
cat order.* | sort -m
are definitely not the same thing (for most input files at least).
- ralph 14y agoPerhaps because sending GiBs through read(2) and write(2) unnecessarily isn't a NOP?
- Athas 14y agoYou can do that sending while you're waiting for the disk to provide said GiBs. I also believe that useless uses of cat are often acceptable for readability (many novices are not familiar with redirecting standard input, particularly not as the first thing on a command line).
- ralph 14y agoWho said the GiBs need to be fetched from disk; they could already be in RAM. Even if not, it's still adding many system calls and context switches when the CPU could be doing other things; the machine isn't running just this one thing.
- alexfoo 14y agoWho said NOPs are free? NOPs still take at least one clock cycle.
- zvrba 14y agoIt's not that simple anymore... In modern CPUs, NOPs are discarded by the decoding units so they never occupy the exeuction units. If decoding BW is not saturated (and most often, it's not), NOPs are indeed "free".