gambas-source-code/benchmark/string1.pl
Benoît Minisini de200aac4c Add a new 'btree' benchmark, that does a lot of object creation and recursive function calls.
[BENCHMARKS]
* NEW: Add a new 'btree' benchmark, that does a lot of object creation and recursive function calls.
* NEW: Rename the 'string' benchmark as 'string1', to avoid name clashes in Python.
* BUG: Fix the HTML table generation.
2023-10-04 22:10:01 +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
}