I'm always wary of these kinds of sub-second benchmarks because more often than not you've only accidentally measured just the compilation and startup times.
I might have some bias though from speeding up a crusty old Perl CGI web apps with multi-second request times down to less than 100ms simply by keeping the perl processes persistent with mod_fcgid or whatever.
I'm always wary of these kinds of sub-second benchmarks because more often than not you've only accidentally measured just the compilation and startup times.
I increased the iteration count by 10x and observed exactly the same pattern:
$ time perl -ne 'print if /number 12345/' < file
[...]
real 0m1.661s
user 0m1.586s
sys 0m0.076s
$ time grep "number 12345" file
[...]
real 0m0.188s
user 0m0.132s
sys 0m0.056s
Comments
I'm always wary of these kinds of sub-second benchmarks because more often than not you've only accidentally measured just the compilation and startup times.
I might have some bias though from speeding up a crusty old Perl CGI web apps with multi-second request times down to less than 100ms simply by keeping the perl processes persistent with mod_fcgid or whatever.
I increased the iteration count by 10x and observed exactly the same pattern:
Cool, thanks for entertaining my superstitions :)