3 ms·
Using cat to redirect the file to /dev/null takes 18s on my machine (a low-end NUC). Just running a noop on the file in Perl (ie. feeding it into a `while (<>)`
by gerikson 3y ago
Using cat to redirect the file to /dev/null takes 18s on my machine (a low-end NUC). Just running a noop on the file in Perl (ie. feeding it into a `while (<>)` loop but not acting on the contents) takes ~2 minutes.
1B lines is a lot, and Java ain't a slouch.
- lessbergstein 3y agoWhy are you using cat at all? Use a pipe. This isn't hard stuff. Don't use <>, feed the file into a scalar or array. it should only take a few seconds to process a billion lines. https://www.perl.com/pub/2003/11/21/slurp.html/#:~:text=Another%20major%20win%20for%20slurping%20over%20line%20by,Plenty%20of%20work%20for%20each%20line%20read%20in https://www.perl.com/pub/2003/11/21/slurp.html/#:~:text=Anot....
- sobellian 3y agoIf it isn't hard, then perhaps you could demonstrate with a complete perl program that you think should beat java.