Ask HN: Really long shell command more performant than many short ones?
I'm experiencing something that I'm not sure about.
I'm noticing a huge performance gain between concatenating commands with && and running the commands one by one.
None of the commands fail, so I'm not sure why that would be.
Is this normal?
6 comments
[ 3.1 ms ] story [ 23.9 ms ] threadI'll post again once I'm back at the PC.
My first reaction to your question was that each command is executed as a separate process and depending on what you are doing, e.g. piping outputs to inputs, using temporary files, other operations could create lots of variances between one run and the next.
Another thought is maybe data is in a faster state of cache in the combined command, but in separate commands is getting dumped to something slower.