in reply to way to find module memory usage?
It won't give you the sizes directly, but the easiest way to convince yourself that your debug code is being exclused is to use B::Deparse, which for reasons I do not understand is invoked by adding -MO=Deparse to your command line.
This is what the output looks like when debug is enabled:
C:\test>type junk.pl #! perl -slw use strict; use constant DEBUG => 1; if( DEBUG ) { print "Debugging..."; } print "Not debugging..."; C:\test>junk.pl Debugging... Not debugging... C:\test>perl -MO=Deparse junk.pl BEGIN { $^W = 1; } BEGIN { $/ = "\n"; $\ = "\n"; } use constant ('DEBUG', 1); use strict 'refs'; do { print 'Debugging...' }; print 'Not debugging...'; junk.pl syntax OK
Note how the conditional block has been replaced by a do block.
And this is what it looks like when debug is disabled:
C:\test>type junk.pl #! perl -slw use strict; use constant DEBUG => 0; if( DEBUG ) { print "Debugging..."; } print "Not debugging..."; C:\test>junk.pl Not debugging... C:\test>perl -MO=Deparse junk.pl BEGIN { $^W = 1; } BEGIN { $/ = "\n"; $\ = "\n"; } use constant ('DEBUG', 0); use strict 'refs'; '???'; print 'Not debugging...'; junk.pl syntax OK
Note that the entire conditional block has been replaced by '???'.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: way to find module memory usage?
by perl-diddler (Chaplain) on Jun 06, 2018 at 20:37 UTC | |
by BrowserUk (Patriarch) on Jun 07, 2018 at 01:04 UTC |