#! perl -slw use strict; use Storable qw[ freeze thaw ]; use Time::HiRes qw[ time ]; use Devel::Size qw[ total_size ]; my @db; for my $ac ( 100 ..999 ) { $db[ $ac - 100 ] = pack 'S*', (1234) x 4899; } print "Total size in ram: ", total_size( \@db ); my $start = time; for ( 1 .. 1e6 ) { my $info = unpack 'S', substr $db[ int( rand 800 ) ], 2*( int( rand 4900 ) ), 2; } printf "1e6 lookups took %.3f\n", time() - $start; my $ram = freeze \@db; print "size on disk (excluding blocking): ", length $ram; $start = time; my @db2 = @{ thaw( $ram ) }; printf "Time to construct hash from storable (ram) file: %.3f\n", time()-$start; __END__ C:\test>826814-b Total size in ram: 8871552 1e6 lookups took 0.813 size on disk (excluding blocking): 8822720 Time to construct hash from storable (ram) file: 0.039