Optimization?

2003-08-14 Thread Morbus Iff
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).

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.

 http://www.ccl4.org/~nick/P/Fast_Enough/
 http://www.panix.com/~comdog/solve_any_perl_problem.pod
--
Morbus Iff ( i put the demon back in codemonkey )
Culture: http://www.disobey.com/ and http://www.gamegrene.com/
Buy My Book! http://amazon.com/exec/obidos/ASIN/0596004605/disobeycom
icq: 2927491 / aim: akaMorbus / yahoo: morbus_iff / jabber.org: morbus


Re: Optimization?

2003-08-14 Thread Rob Casey
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


RE: Optimization?

2003-08-14 Thread richard.foley
You can also use the UsageOnly option in the debugger used via the 'V' command:

[EMAIL PROTECTED]:~ $ perl580 -d -e 0

Loading DB routines from perl5db.pl version 1.19
Editor support available.

Enter h or `h h' for help, or `man perldebug' for more help.

main::(-e:1):   0
  DB<1> use warnings

  DB<2> o UsageOnly
   UsageOnly = '1'
  DB<3> V warnings
%Offsets = 1 item (keys: 4; values: 1; total: 5 bytes)
%DeadBits = 2 items (keys: 7; values: 2; total: 9 bytes)
%register:: = 3 items (keys: 19; values: 82; total: 101 bytes)
%Bits = 2 items (keys: 7; values: 2; total: 9 bytes)
String space: 125 bytes in 17 strings.
Grand total = 249 bytes (1 level deep) + overhead.
  DB<4> 

Richard Foley
---
Ciao - shorter than Aufwiedersehen



>-Original Message-
>From: Rob Casey [mailto:[EMAIL PROTECTED]
>Sent: Tuesday, August 12, 2003 1:30 AM
>To: Morbus Iff; [EMAIL PROTECTED]
>Subject: Re: Optimization?
>
>
>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


Visit our website at http://www.ubs.com

This message contains confidential information and is intended only
for the individual named.  If you are not the named addressee you
should not disseminate, distribute or copy this e-mail.  Please
notify the sender immediately by e-mail if you have received this
e-mail by mistake and delete this e-mail from your system.

E-mail transmission cannot be guaranteed to be secure or error-free
as information could be intercepted, corrupted, lost, destroyed,
arrive late or incomplete, or contain viruses.  The sender therefore
does not accept liability for any errors or omissions in the contents
of this message which arise as a result of e-mail transmission.  If
verification is required please request a hard-copy version.  This
message is provided for informational purposes and should not be
construed as a solicitation or offer to buy or sell any securities or
related financial instruments.