in reply to Re: Regex combining /(foo|bar)/ slower than using foreach (/foo/,/bar/) ???
in thread Regex combining /(foo|bar)/ slower than using foreach (/foo/,/bar/) ???  

exactly. Problem for me is, that if I've got a soulution in the language I use it as it is hopefuly perfectly optimized.

It feels like on those old VAX systems where you could program in assembler some operations faster with simpler ops. One of the reasons RISC was introduced.

If Perl gives me the possiblity of using a 'nice' small solution (/foo|bar/) I always thought I should be able to program a faster solution with a perl PROGRAM ( the for loop ).

But that's just propably my understanding of how things should work.

Jolly - thanx for u'r time.

  • Comment on Re^2: Regex combining /(foo|bar)/ slower than using foreach (/foo/,/bar/) ???

Replies are listed 'Best First'.
Re^3: Regex combining /(foo|bar)/ slower than using foreach (/foo/,/bar/) ???
by hardburn (Abbot) on Feb 21, 2005 at 14:21 UTC

    If Perl gives me the possiblity of using a 'nice' small solution (/foo|bar/) I always thought I should be able to program a faster solution with a perl PROGRAM ( the for loop ).

    I wouldn't think that. At least, not if you're smart about language design. With good semantics, you provide the optimizer more information about what you're trying to do, thus allowing it to make better optimization. Unfortuately, Perl5 has hopelessly bad semantics, so this principle is mostly lost for us.

    "There is no shame in being self-taught, only in not trying to learn in the first place." -- Atrus, Myst: The Book of D'ni.