3 ms·
Using puts, fputs or fwrite (which is what the other implementations do) also buffers, so all the GNU implementation does is special case the buffer to remove t
by bonzini 4y ago
Using puts, fputs or fwrite (which is what the other implementations do) also buffers, so all the GNU implementation does is special case the buffer to remove the overhead of stdio.
- rbanffy 4y agoIs the performance gain worth the less legible implementation?
- jcelerier 4y agoI have never read the source of yes but used it so for me it could be 20 megabytes of source for what I know - as long as it is efficient why would I care ?
- rbanffy 4y agoHow does that efficiency reflect in actual usage? I’d imagine the time waiting for a “y” would be negligible for all but the most trivial tasks.
- jcelerier 4y agogrepping for yes being piped in shell scripts yields a couple hundred matches in my computer - small things add up
- rbanffy 4y agoHow much time is spent generating a “y” compared to do the job the yes is being piped in? In a million years it’d have spared… about a 386 worth of compute ;-)
- MichaelBurge 4y agoI use "yes > file" to benchmark IO, knowing that this is pretty much the "speed of light" for writes. I could use "cp /dev/urandom file" but then it's hard to tell if the filesystem or kernel optimize a copy different from generating your own writes.
- deleted 4y ago[deleted]