Re: Optimization?

[email protected] (Rob Casey) Tue, 12 Aug 2003 09:30:24 +1000
Newsgroups perl.debugger
Message-ID <[email protected]>
G'Day Morbus,

At 05:33 PM 2003-08-11 -0400, Morbus Iff wrote:

>Does debugging include optimization (since, theoretically, slow code == 
>bad code)? I've been meaning for a while to look into speeding up 
>AmphetaDesk, but don't really know what path to take (or whether there is 
>more than one).

One minor point which I would make is that not all slow code is bad code - 
Some code is slow by design as a result of the work required.  Then again, 
if we were wanting raw speed, it could be argued that we should be working 
in C ... :-)

>I know you can do a bunch of stuff with Dprof (most notably, optimizing 
>the first three or so must run routines), but what other optimization 
>tools are available to you? How can I find out what's the biggest 
>structure in memory? How can I find out what variables are being stored in 
>memory (perhaps erroneously)? Etc., etc.

The size of structures in memory can be determined using the Devel::Size 
module by Dan Sugalski - 
http://search.cpan.org/author/DSUGAL/Devel-Size-0.58/Size.pm.

To determine what variables are defined in memory, your best bet is to walk 
the symbol table.  with Padwalker - 
http://search.cpan.org/author/ROBIN/PadWalker-0.10/PadWalker.pm. 
Alternatively you can dump the symbol table using Devel::Symdump - 
http://search.cpan.org/author/EVO/Devel-PreProcessor-1999.0220/lib/Devel/PreProcessor.pm

Regards,
Rob




Rob Casey
Technical Manager
Bluebottle :: Spam Free Email
http://www.bluebottle.com