http://www.perlmonks.org?node_id=11148468


in reply to Re: Rosetta Code: Long List is Long
in thread Rosetta Code: Long List is Long

On macOS, exiting the script requires 15 additional seconds. This is a great test case for comparing "my" vs "our".

my (%by_count, %by_word); # slow cleanup/exiting $ time perl choroba.pl big1.txt big2.txt big3.txt >cpp.tmp start get properties: 21 secs sort + output: 25 secs total: 46 secs real 1m2.072s user 1m0.182s sys 0m1.885s
our (%by_count, %by_word); # fast cleanup/exiting $ time perl choroba.pl big1.txt big2.txt big3.txt >cpp.tmp start get properties: 21 secs sort + output: 25 secs total: 46 secs real 0m47.062s user 0m45.505s sys 0m1.549s

Replies are listed 'Best First'.
Re^3: Rosetta Code: Long List is Long
by choroba (Cardinal) on Dec 01, 2022 at 11:02 UTC
    What Perl version do you run? The final garbage collecting takes about 6 secs on my Linux machine in both 5.26.1 and blead.

    map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
      > What Perl version do you run?

      On macOS, Perl v5.30.2 via perlbrew. The system Perl v5.18.2 is also 15 seconds apart between "my" and "our". Garbage collection is faster on Linux.