When I run the following script:
my @arr = [1..5000000];
for($i=0; $i<5000000; $i++) {
$arr[$i] = $i;
if($i % 1000000 == 0) {
You can always use C or C++ in Perl.This will probably give you a small footprint in some hard jobs. Just an idea using C!
#!/usr/bin/perl
use Inline C;
use strict;
for(my $i=0; $i<5000000; $i++) {
set_array_index($i,$i);
if($i % 1000000 == 0) {
#print "$i\n";
print get_array_index($i)."\n";
}
}
__END__
__C__
int array[5000000];
void set_array_index(int index,int value) {
array[index]=value;
}
int get_array_index(int index) {
if (array[index]==NULL)
return 0;
return array[index];
}