Usage: tie my(@large_array), 'Array::Paged'; tie my(@large_array), 'Array::Paged', page_size => 200; tie my(@large_array), 'Array::Paged', page_size => 100, paging_dir => '/tmp'; # Use @large_array like a usual array
When processing large amounts of data a program may run out of memory. The operating system may impose a limit on the amount of memory a process can consume or the machine may simply lack the required amount of memory.
Array::Paged, a module tieable to an array, intends to solve this problem by breaking the array into pages and writing the pages not in use to disk. Disks tend to be inexpensive and easy to acquire.
The paged array works slower than a regular array because of swapping the data between the disk and memory. Certain operations like shift, unshift and splice turn out to be efficient as these operations are working on pages instead of the whole array.