Timeline for answer to Why there is such a difference in execution time of echo and cat? by Chris Davies
Current License: CC BY-SA 3.0
Post Revisions
9 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Sep 17, 2015 at 8:19 | comment | added | Chris Davies | @mohammad.k Please just quote your variables and try it again. | |
| Sep 17, 2015 at 8:15 | comment | added | Mohammad |
@roaima :What does the command tar cf - | dd bs=1M count=50 do? Does it make a regular file with same characters inside it? If so, in my case the input file is completely irregular with all kind of characters and whitespaces. And again, I used time as you have used, and the result was the one that I said: 54 seconds vs 3 seconds.
|
|
| Sep 17, 2015 at 8:07 | comment | added | Chris Davies | @mohammad.k for the third time: if you quote your variables, the problem goes away. | |
| Sep 17, 2015 at 8:05 | history | edited | Chris Davies | CC BY-SA 3.0 |
Formatting. Duh
|
| Sep 17, 2015 at 8:02 | comment | added | Mohammad | @fpmurphy1 :No. I tried my code. The loop runs only twice, not 10 times. | |
| Sep 17, 2015 at 7:26 | comment | added | Mohammad |
I did as you said, but the problem has not been solved. cat is very, very faster than echo. The first script runs in an average of 3 second, but the second one runs in an average of 54 seconds.
|
|
| Sep 17, 2015 at 7:06 | comment | added | fpmurphy | Actually the loop runs 10 times, not twice. | |
| Sep 17, 2015 at 6:56 | history | edited | Chris Davies | CC BY-SA 3.0 |
Additional explanation
|
| Sep 17, 2015 at 6:26 | history | answered | Chris Davies | CC BY-SA 3.0 |