gambas-source-code/benchmark/string.pl
Benoît Minisini c3f3e60069 Port Python benchmarks to Python 3.
[BENCHMARKS]
* NEW: Port Python benchmarks to Python 3.
2022-09-27 22:16:48 +02:00

18 lines
440 B
Perl
Executable file

#!/usr/bin/perl -w
my $str='abcdefgh'.'efghefgh';
my $imax = 1024 / length($str) * 512;
my $starttime=time();
my $gstr='';
my $i=0;
while($i++ < $imax+1000)
{
$gstr.=$str;
$gstr=~s/efgh/____/g;
my $lngth=length($gstr); ## my $lngth=length($gstr); # Perhaps that would be a slower way
print time()-$starttime," sec\t\t",$lngth/1024,"kb\n" unless $lngth % (1024*64); #print out every 256kb
}