tag:blogger.com,1999:blog-3803541356848955053.post7494098086063413360..comments2016-05-06T18:44:33.019-07:00Comments on YJL: Running cat without a catYu-Jie Linhttps://plus.google.com/115422682039760465813[email protected]Blogger2125tag:blogger.com,1999:blog-3803541356848955053.post-84022597475394899632016-01-25T12:51:22.083-08:002016-01-25T12:51:22.083-08:00those lines got sliced up.. fast= read var &lt;/f...those lines got sliced up..<br /><br />fast= read var &lt;/file/name &amp;&amp; echo $var<br />slow= echo $(&lt;/file/name)Anonymous[email protected]tag:blogger.com,1999:blog-3803541356848955053.post-86376905326392738922016-01-25T12:48:13.494-08:002016-01-25T12:48:13.494-08:00I want to shed light on something I just found rel...I want to shed light on something I just found relating to this.<br />The following benchmarks show that saving the contents of a file to a variable via read and echoing as opposed to simply echoing the file contents from a subshell as shown above takes nearly 1/2 the time! Very surprising to me..<br /><br /># time for i in {0..1000};<br />&gt; do (read var /dev/null;<br />&gt; done;<br />real 0m0.596s<br />user 0m0.030s<br />sys 0m0.140s<br /><br /># time for i in {0..1000};<br />&gt; do (echo $(/dev/null;<br />&gt; done; <br />real 0m0.969s<br />user 0m0.040s<br />sys 0m0.110sAnonymous[email protected]