Re:Unix V5, OpenBSD, Plan 9, FreeBSD, and GNU Coreutils Impl...
by stock_toaster on Saturday February 21, 2015 @09:54PM
(#9088006)
Looking at the history of echo.c in the freebsd tree[1] is pretty interesting too. Seems before this [2] commit (apparently fixes for performance with many arguments) it was pretty simple.
[1]: https://github.com/freebsd/freebsd/blob/master/bin/echo/echo...
[2]: https://github.com/freebsd/freebsd/commit/cbf5708f4336b824b8...
Re:Unix V5, OpenBSD, Plan 9, FreeBSD, and GNU Coreutils Impl...
by userbinator on Sunday February 22, 2015 @01:02AM
(#9088441)
To me this feels like a classic case of "premature optimisation" - by increasing the complexity of the code quite a bit (even adding dynamic allocation), they managed to save only 40 milliseconds on a benchmark involving the echoing of 1000 arguments.
Using 1000 arguments does not seem at all a typical use case for echo.
Re:Unix V5, OpenBSD, Plan 9, FreeBSD, and GNU Coreutils Impl...
by jlarocco on Sunday February 22, 2015 @01:50AM
(#9088544)
I'm not sure "premature" is the right word. I mean, they benchmarked, and maybe even profiled, and made it faster.
My guess is that somone had a weird use case for echo where the old version was slow. He benchmarked, profiled, made some changes, and submitted a patch. "The source code is too long," is a crappy argument, so might as well use the faster, longer code.
ALso surprised how many library's the FreeBSD and GNU flavours want to pull in.