summaryrefslogtreecommitdiff
path: root/lib/warnings.pm
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2010-06-19 21:55:41 +0100
committerNicholas Clark <nick@ccl4.org>2010-06-23 08:44:42 +0100
commit8452af9f2d8674af680c1e3be7554590d5d7261c (patch)
tree3366923355b2fed07e03f255acdb94d457660fde /lib/warnings.pm
parentb46acf92a1bd83c189c4290dd3ae7f5bfa32d2a7 (diff)
downloadperl-8452af9f2d8674af680c1e3be7554590d5d7261c.tar.gz
warnings::import() can exit quickly and efficiently if @_ is empty.
For this platform, cachegrind reckons warnings->import() uses 7% fewer instructions executed and has 9% fewer L1 cache references.
Diffstat (limited to 'lib/warnings.pm')
-rw-r--r--lib/warnings.pm15
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/warnings.pm b/lib/warnings.pm
index 10a7cbfe4e..c6881fecf5 100644
--- a/lib/warnings.pm
+++ b/lib/warnings.pm
@@ -6,7 +6,7 @@
package warnings;
-our $VERSION = '1.09';
+our $VERSION = '1.10';
# Verify that we're called correctly so that warnings will work.
# see also strict.pm.
@@ -368,10 +368,6 @@ sub import
{
shift;
- my $catmask ;
- my $fatal = 0 ;
- my $no_fatal = 0 ;
-
my $mask = ${^WARNING_BITS} ;
if (vec($mask, $Offsets{'all'}, 1)) {
@@ -379,7 +375,14 @@ sub import
$mask |= $DeadBits{'all'} if vec($mask, $Offsets{'all'}+1, 1);
}
- push @_, 'all' unless @_;
+ unless (@_) {
+ # This is equivalent to @_ = 'all' ;
+ return ${^WARNING_BITS} = $mask | $Bits{all} ;
+ }
+
+ my $catmask ;
+ my $fatal = 0 ;
+ my $no_fatal = 0 ;
foreach my $word ( @_ ) {
if ($word eq 'FATAL') {