in reply to Performace calculation
In both the cases you are using regexp.
Method1 seems faster than method2.
To benchmark the code, go for Benchmark module
Here is the comparison....
use strict; use warnings; use Benchmark qw(cmpthese); cmpthese(-1, {method1=>sub {my $item = 'path/path1==new';my ($epath, $relt) = spli +t /==/, $item;},method2=>sub {my $item = 'path/path1==new';my ($epath +, $relt) = $item =~ /([^=]*)==(.*)/;} } ); Rate method2 method1 method2 200037/s -- -37% method1 315836/s 58% --
Regards,
Murugesan Kandasamy
use perl for(;;);
|
|---|