in reply to Performace calculation
If you must know, you can always use the Benchmark module, and run a simple test:
Method 1 will about 1.1 microseconds faster (at least, on my box). So, if I have a million of them, method1 will gain 1 second over method2. That's hardly worth the trouble.#!/usr/bin/perl use strict; use warnings; use Benchmark 'cmpthese'; our $item = '"path/path1==new'; cmpthese(-1, { method1 => 'my ($epath, $relt) = split /==/, $item', method2 => 'my ($epath, $relt) = $item =~ /([^=]*)==(.*)/', }); __END__ Rate method2 method1 method2 334042/s -- -38% method1 535924/s 60% --
I'd pick method1 because, IMO, it's more clear to see what it does.
Oh, and both methods use a regular expression anyway.
|
|---|