s/use diagnostics/use warnings/g ?
Bradley Baetz
bbaetz at student.usyd.edu.au
Sun Aug 25 10:38:46 UTC 2002
What do people think about:
a) removing |use diagnostics|;
b) adding |use warnings|;
|use diagnostics| takes just over 0.25 seconds to load, as measured by
|time perl -c -e 'use diagnostics'| This is because it parses perdiag.pod
at |use| time, including unescaping values found in the pod. (There is at
least a comment in the .pm about how demand loading crashed perl 5.001, so
at least someone thought about the overhead)
0.25 seconds may not sound like much, but its 1/4 of the time to load
index.cgi, and 2.5 times the time it takes for ConnectToDatabase to
connect to localhost.
This means reopening bug 76923 which I closed on the grounds that |use
diagnostics| couldn't possible be taking 5% of show_bug (in fact, it takes
a bit over _15%_ locally, redirecting output to /dev/null). Sorry for
that, Zach.
(My tests before were testing runtime overhead - since this is at compile
time, you need to remove |use diagnostics| from _all_ .pm + .pl files
involved. For show_bug, this includes bug_form.pl, show_bug.cgi, CGI.pl,
globals.pl, *.pm, and Bugzilla/*.pm, and possibly a couple more)
There aren't that many warnings we run into, and |perldoc perldiag| can
help for unfamilar cases. It will also stop the logs being cluttered up
with detailed explinations which we don't want/need (This was why I
started looking into this originally)
The second thing is to add |use warnings| (instead of using -w). This
allows us to scope warnings, and make them fatal, too. It probably also
makes warnings get generated on win32, but that may be happening anyway.
However, I have this vague recollection that thats a perl5.6 thing. If it
is, then we shouldn't do this just yet (I can't seem to logon to the
machine at my university which uses 5.005 to check this, though)
Thoughts?
Bradley
More information about the developers
mailing list