Thread Regexes: Geschwindigkeitsoptimierung (13 answers)
Opened by GoodFella at 2007-04-06 19:31

bloonix
 2007-04-08 22:32
#75730 #75730
User since
2005-12-17
1615 Artikel
HausmeisterIn
[Homepage]
user image
[quote=PerlProfi,08.04.2007, 20:25]@opi, ja sorry wegen des modifiers, ich hatte einfach die regexp von goodfella genommen und in qr// geschrieben.[/quote]
kein problem... sowas hatte ich mir schon gedacht. :)

@GoodFella... ich möchte noch was hinzufügen...

Mit "ausserhalb der Schleife definieren" meinte ich nicht, dass man jede
einzelne Regex ausserhalb definieren soll. Sowas hier geht natürlich
auch:

Code: (dl )
1
2
3
4
5
   my $rx = /\d+/;

  for (0..100000) {
     'foo 1 bar' =~ /foo $rx bar/o;
  }


und

Code: (dl )
1
2
3
4
5
sub rx_best {
  for (0..100000) {
     1 =~ /\d+/;
  }
}


bleibt unschlagbar ;)\n\n

<!--EDIT|opi|1176074164-->
What is a good module? That's hard to say.
What is good code? That's also hard to say.
One man's Thing of Beauty is another's man's Evil Hack.

View full thread Regexes: Geschwindigkeitsoptimierung