From: Wybo Dekker Date: 2010-01-04T18:44:51+09:00 Subject: Re: Is ruby's regex slower? > It seems like most of the time would be spent loading the environment and > printing the output, making it difficult to compare regexp speeds. Sure; so why not do it 1000 times: #!/usr/bin/ruby 1000.times do File.open("index.html").each do |c| puts $1 if /href="http:\/\/(.*?)\/.*" target="_blank"/ =~ c end end time ./test.rb >/tmp/t elap 6.511 user 6.336 syst 0.136 CPU 99.40% #!/usr/bin/perl for ($i=0; $i<1000; $i+=1) { open HD,"index.html" or die $!; while() { print $1,"\n" if /href="http:\/\/(.*?)\/.*" target="_blank"/; } close HD; } time ./test.pl >/tmp/t elap 0.864 user 0.844 syst 0.020 CPU 100.04% So perl is 7 or 8 times faster here. -- Wybo