[Bioperl-l] Re: issues with _rearrange

Matthew Pocock matthew_pocock@yahoo.co.uk
Fri, 20 Sep 2002 12:40:15 +0100


Could you auto-generate <foo>_prety subs that just call 
shift-><foo>(_rearange(@)), and have <foo> bypass _rearange totaly? 
People who want performance would call <foo> with an args list, and 
people who want nice names would call <foo>_prety with a hash. Perl 
makes this kind of thing quite easy.

Matthew

Steve Chervitz wrote:
> --- Aaron J Mackey <ajm6q@virginia.edu> wrote:
> 
>>On Thu, 19 Sep 2002, Aaron J Mackey wrote:
>>
>>
>>>my ($self, @args) = @_;
>>>my ($a1, $a2, $a3) = $self->_rearrange([qw(a1 a2 a3)], @args);
>>>
>>>becomes:
>>>
>>>my ($self, %args) = @_;
>>>my ($a1, $a2, $a3) = @args{qw(a1 a2 a3)};
>>
>>Before anyone jumps down my throat, I'm aware of all the -a1, -A1, A1, a1
>>options that _rearrange handles; things are never completely as simple as
>>we first believe them to be ;)
>>
> 
> 
> Another thing to try is exporting _rearrange from RootI so that it can be used
> as a class method, instead of an instance method, i.e., call it as _rearrange(
> ... ) rather than $self->_rearrange( ... ). This should improve performance.
> 
> I've always been concerned about all of the overhead from _rearrange calls, so
> Aaron's suggestion seems reasonable to me. _rearrange is convenient, but maybe
> it's a little *too* convenient. Allowing this much flexibility in specifying
> method arguments is probably not necessary as many programmers and users are
> accustomed to precisely defined arg lists. 
> 
> Typically, our method PODs state what the allowable arguments are without
> stating that the hash keys are case-insensitive (and in some cases optional).
> So I'd bet that most users don't know this flexibility exists and we're taking
> a performance hit unnecessarily.
> 
> Before deprecating _rearrange, I'd be interested to know how much the class
> function strategy improves performance, and how much not calling it at all
> further improves it.
> 
> 
> =====
> Steve Chervitz
> sac@bioperl.org
> 
> __________________________________________________
> Do you Yahoo!?
> New DSL Internet Access from SBC & Yahoo!
> http://sbc.yahoo.com
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l@bioperl.org
> http://bioperl.org/mailman/listinfo/bioperl-l
> 


-- 
BioJava Consulting LTD - Support and training for BioJava
http://www.biojava.co.uk