gambas-source-code/benchmark/polynom.pl
Benoît Minisini f98642e44a [SCRIPTER]
* BUG: Be more intelligent when parsing arguments. Now all arguments after 
  the first non option argument are sent to the script process.

[INTERPRETER]
* OPT: Remove a previous optimization that made benchmarks slower, contrary 
  to what valgrind tells. No idea why exactly, maybe a valgrind cache
  simulation problem.

[BENCHMARKS]
* NEW: Do less in the polynom benchmark, so that it runs about as long as
  the other benchmarks.


git-svn-id: svn://localhost/gambas/trunk@6621 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2014-11-09 22:06:07 +00:00

35 lines
408 B
Perl
Executable file

#!/usr/bin/perl -w
use strict;
sub poly($)
{
my $n = 500000;
my $x = $_[0];
my $mu = 10;
my $pu = 0;
my @pol;
foreach (0 .. $n - 1) {
foreach (0 .. 99) {
$pol[$_] = $mu = ($mu + 2) / 2;
}
my $s = 0;
foreach (0 .. 99) {
$s = $x * $s + $pol[$_];
}
$pu += $s;
}
return $pu;
}
my $res;
for (1..4) {
$res = poly(0.2);
print "$res\n";
}