What Stefan means is doing something like this: pattern = ARGS[1] let rex = pattern.re
and then using `rex` instead of `pattern.re` in the two spots inside the `while(fIn.readline(line))` loop. That one change made this run about 4X faster on my machine. [ With memfiles you might be able to get it faster than the editors you mention. ] Edit: Fixes like yglukhov mentions may also help, but how much depends a lot on the density of matches in the file.