Kornelius Kalnbach wrote:
[...]
> 
> It's still slower. Perl has regular expression magic beyond my 
> imagination, though. I heard they take the most "rare" character in the 
> literal part of the regex (let's say, the colon) and search for it using 
> machine code, and then work their way backwards to the beginning of the 
> regexp...

I think that's only done when study is called, but I could be wrong.

> 
> Say what you want, but Perl rocks when it comes to text processing 
> speed.
> 
> Python is even faster:
> 
>  import re
>  regexp = re.compile(r'href="http://([^"/]*)/[^"]*"\s+target="_blank"')
>  for i in xrange(1000):
>      with open("index.html") as f:
>          for m in regexp.finditer(f.read()):
>              print m.group(1)
> 
> time python2.6 regex.py > /dev/null
> real  0m0.943s
> user  0m0.880s
> sys  0m0.053s

Yeah.  I love Ruby, but I'm getting a bit annoyed by the fact that it's 
so much slower than Python...

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
marnen / marnen.org
-- 
Posted via http://www.ruby-forum.com/.