in reply to Bizarre Array Size Disparity
5.7 times memory to disk ratio is not unusual.
Eg: A file that takes 12MB on disk, requires 72MB in ram:
C:\test>perl -le"printf qq[%010u\n], $_ for 1 .. 1e6" >1e6x10.txt C:\test>dir 1e6x10.txt 17/05/2012 18:13 12,000,000 1e6x10.txt C:\test>perl -MDevel::Size=total_size -e"@a=<>; print total_size \@a" +1e6x10.txt 72000176
The power and flexibility of Perl's arrays comes from their complex and flexible internal structure. The cost is the memory usage.
There are often ways of storing data in Perl that substantially reduces that internal overhead whilst still giving you the access you need. You'd need to show us what the data consists of, and how you need to access it.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Bizarre Array Size Disparity
by sunmaz (Novice) on May 17, 2012 at 17:26 UTC | |
by BrowserUk (Patriarch) on May 17, 2012 at 17:50 UTC | |
by sunmaz (Novice) on May 17, 2012 at 18:15 UTC | |
by BrowserUk (Patriarch) on May 17, 2012 at 18:23 UTC | |
by sunmaz (Novice) on May 17, 2012 at 18:29 UTC | |
| |
by sunmaz (Novice) on May 17, 2012 at 18:08 UTC | |
by BrowserUk (Patriarch) on May 17, 2012 at 18:12 UTC | |
by sunmaz (Novice) on May 17, 2012 at 18:19 UTC | |
|
Re^2: Bizarre Array Size Disparity
by sunmaz (Novice) on May 17, 2012 at 17:29 UTC |