Re:Why Python Is Slow: Looking Under the Hood
by haberman on Thursday November 20, 2014 @02:34AM
(#8634717)
> 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
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.