in reply to Re^2: Thread::Queue memory issue with nested maps but not foreach loops...
in thread Thread::Queue memory issue with nested maps but not foreach loops...

Sorry, but that simply cannot be true.

At least not for large ranges:

C:\test>perl -MTime::HiRes=time -E"$t=time; ++$c for 1..1e6; say time- +$t; <>" 0.0741260051727295 5.2 MB C:\test>perl -MTime::HiRes=time -E"$e=1e6;$t=time; ++$c for 1..$e; say + time-$t; <>" 0.0663371086120605 5.3 MB C:\test>perl -MTime::HiRes=time -E"$t=time; ++$c for 1..1e7; say time- +$t; <>" 0.635999917984009 5.2 MB C:\test>perl -MTime::HiRes=time -E"$e=1e7;$t=time; ++$c for 1..$e; say + time-$t; <>" 0.645999908447266 5.3 MB C:\test>perl -MTime::HiRes=time -E"$t=time; ++$c for 1..1e8; say time- +$t; <>" 6.22199988365173 5.2 MB C:\test>perl -MTime::HiRes=time -E"$e=1e8;$t=time; ++$c for 1..$e; say + time-$t; <>" 6.46099996566772 5.3 MB C:\test>perl -MTime::HiRes=time -E"$t=time; ++$c for 1..1e9; say time- +$t; <>" 61.9520001411438 5.2MB C:\test>perl -MTime::HiRes=time -E"$e=1e9;$t=time; ++$c for 1..$e; say + time-$t; <>" 64.4389998912811 5.3 MB

There isn't any evidence for it at small range sizes:

C:\test>perl -MTime::HiRes=time -E"$t=time; ++$c for 1..1e2; say time- +$t; <>" 2.09808349609375e-005 5.2 MB C:\test>perl -MTime::HiRes=time -E"$e=1e2;$t=time; ++$c for 1..$e; say + time-$t; <>" 1.9073486328125e-005 5.3 MB

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

The start of some sanity?

Replies are listed 'Best First'.
Re^4: Thread::Queue memory issue with nested maps but not foreach loops...
by ikegami (Patriarch) on Mar 05, 2012 at 06:55 UTC

    I stand corrected. I got two things mingled. It only flattens a constant range at compile-time when it would otherwise be flattened at run-time. (e.g. my @a = (1..10_000);)