Hacker News new | ask | show | jobs
by riffraff 2093 days ago
Probably the equivalent thing to test would be

      regexp = /\b\w{15}\b/
      IO.foreach('logs1.txt') do |line|
        puts line if regexp.match?(line)
      end
I imagine this will in both cases mostly be testing the computer's IO.

Regexp.compile doesn't do anything substantially different from Regexp.new or a literal (i.e. it doesn't optimize the regular expression or something) so I think the difference is just random fluctuations.