in reply to Peeling the Peelings
After reading the posts - especially the benchmarks, it seems that the code is not as bad as I thought. However just by looking at it once again and looking at the "80% speedup" for the level 0 case, I came with 2 improvements:
sub get_proparg { my $propstr = shift; # get the property string my $level = shift || return $propstr; # get the level we want to +extract my $cnt; # initialize counter if($level == -1) { # special case, get the innermost argum +ent $propstr =~ /\(([^\(\)]+)\)+/; return $1; } else { # get whatever argument $level indicate +s for($cnt = 0;$cnt<$level; $cnt++) { $propstr =~ /\((.+)\)/; $propstr = $1; } return $propstr; } }
Bye
PetaMem All Perl: MT, NLP, NLU
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Peeling the Peelings
by bobn (Chaplain) on Jul 02, 2003 at 05:40 UTC | |
by PetaMem (Priest) on Jul 02, 2003 at 08:01 UTC | |
by EvdB (Deacon) on Jul 02, 2003 at 14:31 UTC | |
by diotalevi (Canon) on Jul 02, 2003 at 19:49 UTC | |
by EvdB (Deacon) on Jul 03, 2003 at 09:16 UTC | |
by bobn (Chaplain) on Jul 02, 2003 at 15:51 UTC | |
by EvdB (Deacon) on Jul 03, 2003 at 09:02 UTC | |
by Jasper (Chaplain) on Jul 02, 2003 at 11:40 UTC | |
by Aristotle (Chancellor) on Jul 02, 2003 at 15:48 UTC | |
by bobn (Chaplain) on Jul 02, 2003 at 17:00 UTC |