From: Nicholas Clark Date: Sun, 8 Jan 2006 13:15:30 +0000 (+0000) Subject: Tweak the code that generates unique entries in @POSIX::EXPORT so that X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a146a244ce1425446618620fe96b3481b5463a4f;p=p5sagit%2Fp5-mst-13.2.git Tweak the code that generates unique entries in @POSIX::EXPORT so that the array ends up with shared hash key scalars, for a memory saving. p4raw-id: //depot/perl@26709 --- diff --git a/ext/POSIX/POSIX.pm b/ext/POSIX/POSIX.pm index cd6188d..895c554 100644 --- a/ext/POSIX/POSIX.pm +++ b/ext/POSIX/POSIX.pm @@ -960,10 +960,11 @@ sub load_imports { # Exporter::export_tags(); { # De-duplicate the export list: - my %seen; - for (values %EXPORT_TAGS) { - push @EXPORT, grep {!$seen{$_}++} @$_; - } + my %export; + @export{map {@$_} values %EXPORT_TAGS} = (); + # Doing the de-dup with a temporary hash has the advantage that the SVs in + # @EXPORT are actually shared hash key sacalars, which will save some memory. + push @EXPORT, keys %export; } @EXPORT_OK = qw(