4 ms·
I found a benchmark that suggests the performance gap between a pipe and input redirection is insignificant for most workloads, but there would indeed start to
by hyper_reality 7y ago
I found a benchmark that suggests the performance gap between a pipe and input redirection is insignificant for most workloads, but there would indeed start to be a difference for the exact case discussed here (grepping a large file): http://oletange.blogspot.com/2013/10/useless-use-of-cat.html http://oletange.blogspot.com/2013/10/useless-use-of-cat.html
Thanks for your tip, it's clearly the best of both worlds for this purpose.
- burntsushi 7y agoIncidentally, ripgrep will actually be faster in this case generally (on Linux at least) when given an explicit file path, since that lets it use memory maps. For example: $ time rg QZQZQZQZ < subtitles.en.txt real 1.842 user 0.552 sys 1.287 maxmem 9 MB faults 0 $ time rg QZQZQZQZ subtitles.en.txt real 1.210 user 0.776 sys 0.433 maxmem 9510 MB faults 0 (See my other comments in this thread for where to get subtitles.en.txt.)