in reply to Re^3: Memory usage double expected -- further questions (deparse)
in thread Memory usage double expected
more words will be appreciated: do you mean in my $x = 'a' x (2**30) the right part RHS is folded by the constant folding optimization and.. it is bugged because it slurp memory twice?
This double memory (let see if I understand it) is firstly allocated at compile time and then another time when $x is used at runtime?
If so, then in foreach my $order ( qw(20 24 30 32) ){ $x = 'a' x ( 2 ** $order ) there is no folding? Is because of this it does not slurp memory twice? I'd expected the folding happening 4 times (20 24 30 32) if this should be an optimization.
This sounds really weird and bugged to me: if we spot this only with huge datastructures is only because it becomes noticeable but this will be true also for my $x = 'a' x (2**1) or (even for?) my $x = 42 ..really unexpected!
Should I resuscitate ancient perl to see if it was always the same?
L*
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Memory usage double expected -- further questions (deparse)
by dave_the_m (Monsignor) on Oct 28, 2022 at 12:51 UTC | |
by Discipulus (Canon) on Dec 06, 2022 at 11:41 UTC | |
|
Re^5: Memory usage double expected -- further questions (deparse)
by LanX (Saint) on Oct 28, 2022 at 13:54 UTC |