in reply to Re: Performance penalty of using qr//
in thread Performance penalty of using qr//
Hi LanX,
The inner for loops are each executed 3,789,182 times.
And yes, I originally had $s =~ /$re/ instead of $s =~ $re — it made no appreciable difference.
Update: Deparsing suggests that Perl adds the slashes anyway:
16:57 >perl -we "my $q = qr/^(\d+)$/; 123 =~ $q; print qq[$1\n];" 123 16:57 >perl -MO=Deparse -we "my $q = qr/^(\d+)$/; 123 =~ $q; print qq[ +$1\n];" BEGIN { $^W = 1; } my $q = qr/^(\d+)$/; 123 =~ /$q/; print "$1\n"; -e syntax OK 16:57 >
Cheers,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Performance penalty of using qr//
by LanX (Saint) on Dec 21, 2017 at 08:02 UTC |