Just another Perl shrine | |
PerlMonks |
Re: Memory efficient way to deal with really large arrays?by LanX (Saint) |
on Dec 13, 2020 at 15:09 UTC ( [id://11125111]=note: print w/replies, xml ) | Need Help?? |
> Now in C, to do this I only need 5GB of ram: For the pairs: 500M * 4 (32bit int) * 2 (pairs) = 4GB. For the occurances: 1G * 1 (8bit int) = 1GB that's an illusion, if you use an array of bytes in C, you'll have 2**32 potential points. That's already 4.3GB for the occurrence counts in @d, not 1GB. But if you think it's that easy in C, you'll easily reproduce it's arrays with pack , substr and unpack in Perl. Of course slower, but you haven't told us yet what your goal is.
Cheers Rolf
In Section
Seekers of Perl Wisdom
|
|