3 ms·
> Who needs more than 2 billion elements in an array? The best case I've seen for this is memory mapping (mmap). There's long been a tradeoff between simple-d
by mrkeen 2y ago
> Who needs more than 2 billion elements in an array?
The best case I've seen for this is memory mapping (mmap).
There's long been a tradeoff between simple-data & complex-algorithm and complex-data & simple-algorithm. And the complex-data approach has all but won in the typical OO or web-dev shop.
In short, mmap gives you the power to treat files as arrays. You can just open a 200GB file and run qsort on it, or do a binary search or whatever.
The operating system takes care of when to move things in and out of ram, and it's pretty good at it. Not only that, but it stays in the cache between invocations of your program. So you can crash out, and resume processing as fast as you can hit ctrl-c, up, enter.