Re: Upcoming presentation on expression evaluators at the DELPHISIG in Washington DC



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))))))


.



Relevant Pages

  • Re: Upcoming presentation on expression evaluators at the DELPHISIG in Washington DC
    ... Sin and cos functions are still computed by the FPU and SSE offers ... Sin and cos are "heavy" functions which take a lot of time compute. ... >evaluators is again played down. ... >all power of two, for all integer power or for all powers. ...
    (borland.public.delphi.non-technical)
  • Re: From my blog (was Hello? Anyone there?)
    ... I usually look at at least two Bibles ... to say "...putting away of sin and deliverance of the sinner from the power ... from the power of sin in the sense that we can successfully resist it. ... Quaker theology of perfection--is one's view then one is going to use ...
    (soc.religion.quaker)
  • Re: Fedora aint playin around w/Firefox 3.
    ... A functional family lives to ... But, once Power and Authority is assumed, it contains equal and ... ..the Sin of Ignorance, ...
    (Fedora)
  • Re: low power tv
    ... It only went away when the district power failed. ... Meter bases!! ... blowing electric bulbs, or the living room lights dim when Mom fires up ... ..the Sin of Ignorance, ...
    (Fedora)
  • Re: TOTPJS - Adam and the priesthood
    ... > Regarding the power to lose and to bind. ... "loose". ... "loosed" from the bonds of sin, one is freed from the control of sin, and ...
    (soc.religion.mormon)