I once compared the speed of these two approaches, rather accidentally. I did output colorization by adding ANSII sequences. I thought, of course one process must be more efficient than a pipe of processes. After the rewrite, I was disappointed about the slowdown and reverted back to the pipe.
PS I checked back and I used sed rather than grep. I think the result would hold for grep but the morale is that you should verify rather than assume.
I have around 50 seds in the pipe, running in parallel (which is what makes it faster), it would have been a half of that when I tried the rewrite.
PS I checked back and I used sed rather than grep. I think the result would hold for grep but the morale is that you should verify rather than assume.
I have around 50 seds in the pipe, running in parallel (which is what makes it faster), it would have been a half of that when I tried the rewrite.