[Bioperl-l] Re: issues with _rearrange

Tim Bunce Tim.Bunce@pobox.com
Mon, 23 Sep 2002 12:22:39 +0100


On Fri, Sep 20, 2002 at 11:14:13AM -0700, Hilmar Lapp wrote:
> On Friday, September 20, 2002, at 09:39 AM, Ewan Birney wrote:
> >
> >Tim - you are a legend.
> >
> >guys - I am planning to apply Tim's new _rearrange now at least 
> >which is a
> >definite win for most other routes right? Any objections?
> 
> If you don't do it, I'll do. ;-)
> 
> Tim, two questions: the conclusion is that s// is slower (~2x) than tr//?
> Would substr($_,0,1,"") (for removing the initial hyphen) give 
> away the speedup, two?

But why do s// or substr if the tr// can do it all?

(A significant part of micro-optimizing perl code focusses on doing
more with fewer ops and expressions so the effect of opcode dispatch etc
are reduced. Another is reducing data copies.)

The Benchmark module make it easy to try out different snippets of
code and see how they compare.

Tim.