This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Reduce SelectSaver memory footprint
authorNicolas R <atoomic@cpan.org>
Thu, 8 Sep 2016 20:29:46 +0000 (14:29 -0600)
committerJames E Keenan <jkeenan@cpan.org>
Fri, 7 Oct 2016 20:58:25 +0000 (16:58 -0400)
This is saving about 500k when using SelectSaver
as most of the time Carp is not required.

before> perl -I. -e 'require q{lib/SelectSaver.pm}; print qx{grep VmRSS /proc/$$/status}'
VmRSS:      2920 kB

after> perl -I. -e 'require q{lib/SelectSaver.pm}; print qx{grep VmRSS /proc/$$/status}'
VmRSS:      2352 kB

Committer:  Increment SelectSaver $VERSION.  Add perldelta entry for SelectSaver.

For: RT # 129235

lib/SelectSaver.pm
pod/perldelta.pod

index b67adff..8899495 100644 (file)
@@ -1,6 +1,6 @@
 package SelectSaver;
 
-our $VERSION = '1.02';
+our $VERSION = '1.03';
 
 =head1 NAME
 
@@ -35,11 +35,10 @@ that was selected when it was created.
 =cut
 
 require 5.000;
-use Carp;
-use Symbol;
+use Symbol q{qualify};
 
 sub new {
-    @_ >= 1 && @_ <= 2 or croak 'usage: SelectSaver->new( [FILEHANDLE] )';
+    @_ >= 1 && @_ <= 2 or do { require Carp; Carp::croak('usage: SelectSaver->new( [FILEHANDLE] )') };
     my $fh = select;
     my $self = bless \$fh, $_[0];
     select qualify($_[1], caller) if @_ > 1;
index 2c3986b..ab2972d 100644 (file)
@@ -121,6 +121,10 @@ XXX
 
 L<XXX> has been upgraded from version A.xx to B.yy.
 
+=item *
+
+L<SelectSaver> has been upgraded from version 1.02 to 1.03.
+
 =back
 
 =head2 Removed Modules and Pragmata