meonkeys has asked for the wisdom of the Perl Monks concerning the following question:
Profiling gives...package Foo; sub bar {} sub zap {} package main; Foo::bar(); Foo::bar(); Foo::zap(); Foo::zap();
Ok, that all looks peachy. Now, try turning on 'use strict' in package Foo. Code becomes...[adamm@twins adamm]$ perl -d:DProf test.pl [adamm@twins adamm]$ dprofpp tmon.out Total Elapsed Time = 0.009968 Seconds User+System Time = 0.019968 Seconds Exclusive Times %Time ExclSec CumulS #Calls sec/call Csec/c Name 0.00 0.000 -0.000 2 0.0000 - Foo::bar 0.00 0.000 -0.000 2 0.0000 - Foo::zap
Profiling now shows:package Foo; use strict; sub bar {} sub zap {} package main; Foo::bar(); Foo::bar(); Foo::zap(); Foo::zap();
Why are there supposedly 3 calls to Foo::BEGIN()? Might this be a bug?[adamm@mustafa adamm]$ perl -d:DProf test.pl [adamm@mustafa adamm]$ dprofpp tmon.out Total Elapsed Time = 0.019937 Seconds User+System Time = 0.019944 Seconds Exclusive Times %Time ExclSec CumulS #Calls sec/call Csec/c Name 0.00 0.000 -0.000 3 0.0000 - Foo::BEGIN 0.00 0.000 -0.000 1 0.0000 - strict::import 0.00 0.000 -0.000 1 0.0000 - strict::bits 0.00 0.000 -0.000 2 0.0000 - Foo::zap
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: possible bug in Devel::DProf code profiling under 'use strict'
by chromatic (Archbishop) on Oct 02, 2003 at 19:42 UTC |