[Melbourne-pm] Just how much does $& slow things down?
lsharpe at pacificwireless.com.au
Thu Nov 20 18:42:56 PST 2008
Can anybody give me an idea of just how much impact using $& can have
on a program?
I have a function which does something like this:
foreach my $this_line(@an_array)
next if ($this_line=~m/something which indicates we're not
if ($this_line =~m/something we are interested in \d*\.*\d*)
# Do some stuff with $foo
elsif ($this_line=~m/something else interesting \d*\.*\d*/)
# Do something with $bar
@an_array could be anything up to about 50 elements.
This is the only place in the whole program which uses a regex, so the
impact on other parts of the program should be nil.
I just don't know if it's going to be worth removing those references to
$&, and how much it will benefit the running of the program.
Obviously, the bigger @an_array is, the larger the impact, but I can
safely say it won't be much bigger than about 50.
So, are we talking an order of magnitude slower? More? Less? Anybody
even want to take an educated guess?
Network Systems Engineer
Ph +61 3 9584 8966
Mob 0408 009 502
Helpdesk 1300 300 616
email lsharpe at pacificwireless.com.au
<blocked::mailto:lsharpe at pacificwireless.com.au>
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Melbourne-pm