Re: Upcoming presentation on expression evaluators at the DELPHISIG in Washington DC
- From: "Atmapuri" <janez.makovsek@xxxxxxx>
- Date: Mon, 5 Sep 2005 17:40:20 +0200
Hi!
Ok, I ran this on our "beast" and here are the results:
var ar: array of double;
i,k: integer;
a1,b: double;
begin
a := 0.5;
b := 0.5;
SetLength(ar,1000);
j := GetTickCount;
for i := 0 to 300-1 do
for k := 0 to 1000-1 do ar[k] :=
sin(cos(sin(cos(sin(cos(a1))))))/sin(cos(sin(cos(sin(cos(b1))))));
j := GetTickCount - j;
Caption := IntToStr(j);
end;
On my machine this gives 275ms. Our evaluator does it in 240 ms.
The CPU is 2.4Ghz Intel. Your test is more a test of the CPU than
of the parser for the following reasons:
1.) The expression is very long. This is not usual. Any overhead associated
with the cost of "wrapping" and specifically the Evaluate method itself
is played down.
2.) Sin and cos functions are still computed by the FPU and SSE offers
little help there. (my problem <g>)
3.) Sin and cos are "heavy" functions which take a lot of time compute.
So, all the cost of transitions between consecutive function calls inside
the
evaluators is again played down.
This again is a weird function:
2^2^2^2
It leaves the observer questioning if this performance will be retained for
all power of two, for all integer power or for all powers. A more balanced
test that would test the weak spots of the evaluators and would include very
simple
and short expressions:
a + b
a*b*c
a^2*x + b*x + c
They leave the parser truly bare against its week points.
And no test for complex numbers? (<g>) Here is some comparison.
I tested the function a + b and got the following results:
The delphi compiled version: (changed line from the code above)
for k := 0 to 1000-1 do ar[k] := a + b;
Gives 440 ms.
Our evalutor needs: 7 ms. (Yup, Its true, I had to adjust the iterator
by a factor of 10 to get a good measurement).
Best Regards!
Atmapuri.
"Alexei Cioina" <cioina@xxxxxxxxxxx> wrote in message
news:431c3e1e$1@xxxxxxxxxxxxxxxxxxxxxxxxx
>
> Expression:
> sin(cos(sin(cos(sin(cos(x))))))/sin(cos(sin(cos(sin(cos(y))))))
.
- Follow-Ups:
- References:
- Upcoming presentation on expression evaluators at the DELPHISIG in Washington DC
- From: rbwinston
- Re: Upcoming presentation on expression evaluators at the DELPHISIG in Washington DC
- From: Hallvard Vassbotn
- Re: Upcoming presentation on expression evaluators at the DELPHISIG in Washington DC
- From: Alexei Cioina
- Upcoming presentation on expression evaluators at the DELPHISIG in Washington DC
- Prev by Date: Re: kylix request
- Next by Date: Re: kylix request
- Previous by thread: Re: Upcoming presentation on expression evaluators at the DELPHISIG in Washington DC
- Next by thread: Re: Upcoming presentation on expression evaluators at the DELPHISIG in Washington DC
- Index(es):
Relevant Pages
|