It's been optimized when it's followed by a constant string.cmpthese(-3, { cc => sub { "japhy{japhy}japhy" =~ /{[^}]*}/ }, ds => sub { "japhy{japhy}japhy" =~ /{.*?}/ }, }); Benchmark: running cc, ds, each for at least 3 CPU seconds... cc: 72937.13/s (n=223917) ds: 76422.67/s (n=229268) Rate cc ds cc 72937/s -- -5% ds 76423/s 5% -- cmpthese(-3, { cc => sub { "this is an amazingly long string" =~ /\s[^l]*l/ }, ds => sub { "this is an amazingly long string" =~ /\s.*?l/ }, }); Benchmark: running cc, ds, each for at least 3 CPU seconds... cc: 91565.26/s (n=282021) ds: 117002.10/s (n=390787) Rate cc ds cc 91565/s -- -22% ds 117002/s 28% --
_____________________________________________________
Jeff[japhy]Pinyan:
Perl,
regex,
and perl
hacker.
s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Ovid, Long Live .*? (dot star question-mark)
by blakem (Monsignor) on Sep 06, 2001 at 05:14 UTC | |
by danger (Priest) on Sep 06, 2001 at 05:46 UTC | |
by japhy (Canon) on Sep 06, 2001 at 05:56 UTC | |
by tilly (Archbishop) on Sep 06, 2001 at 18:10 UTC | |
by japhy (Canon) on Sep 06, 2001 at 20:32 UTC | |
by japhy (Canon) on Sep 06, 2001 at 05:20 UTC | |
|
(Ovid) Re: Ovid, Long Live .*? (dot star question-mark)
by Ovid (Cardinal) on Sep 06, 2001 at 20:24 UTC | |
by japhy (Canon) on Sep 06, 2001 at 20:53 UTC |