G
georg.heiss
Hi, i try to allocate 10GB of memory on my box and it takes about 27
seconds.
Is there a faster way to do this?
my $gras = "A" x (1024 * 1024 * 10000);
my $needle = "B";
print "\nAllocated " . length($gras) . " byte buffer\n";
$gras = $gras.$needle;
print "Allocated " . length($gras) . " byte buffer\n";
if ($gras ~~ /$needle/) {print "found needle\n"; }
###
$ time perl memtake.pl &
Allocated 10485760000 byte buffer
Allocated 10485760001 byte buffer
found needle
real 0m27.280s
user 0m13.429s
sys 0m13.839s
seconds.
Is there a faster way to do this?
my $gras = "A" x (1024 * 1024 * 10000);
my $needle = "B";
print "\nAllocated " . length($gras) . " byte buffer\n";
$gras = $gras.$needle;
print "Allocated " . length($gras) . " byte buffer\n";
if ($gras ~~ /$needle/) {print "found needle\n"; }
###
$ time perl memtake.pl &
Allocated 10485760000 byte buffer
Allocated 10485760001 byte buffer
found needle
real 0m27.280s
user 0m13.429s
sys 0m13.839s