in reply to Re^5: In-place sort with order assignment
in thread In-place sort with order assignment
Hm. Do you see anything wrong with this usage that would prevent the in-place optimisation from kicking in?
perl -E"my @a; $a[$_]=rand for 1..1e6; <>; @a = sort @a; <>"
Because after the array is populated, memory usage stands at 42mb. After the sort, it jumped to 150MB.
Which admittedly is substantially better than:
perl -E"my @a; $a[$_]=rand for 1..1e6; <>; my @b = sort @a; <>"
Where it leaps from 42MB to 280MB. But it doesn't meet my idea of 'in-place'.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: In-place sort with order assignment
by salva (Canon) on Sep 20, 2010 at 08:54 UTC | |
by BrowserUk (Patriarch) on Sep 20, 2010 at 12:10 UTC |