4 ms·
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 argu
by stock_toaster 12y ago
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.c https://github.com/freebsd/freebsd/blob/master/bin/echo/echo...
[2]: https://github.com/freebsd/freebsd/commit/cbf5708f4336b824b85366d55d42235852183b83?diff=split#diff-adbe8d3b33ea648fcf834ed6610325c6R114 https://github.com/freebsd/freebsd/commit/cbf5708f4336b824b8...
- userbinator 12y agoTo 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.
- jlarocco 12y agoI'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.
- ild 12y agoWell 40 ms can be a lot or a little, depending on the number after optimization. If, for example the input was 1000 1-letter arguments, 40 ms to output 2kb is too much.
- ild 12y agoWell 40 ms can be a lot or a little, depending on the number after optimization. If, for example the input was 1000 1-letter arguments, 40 ms to output 2kb is too much.