[OT] Re: WP-34s: Speed benchmark Message #11 Posted by Tim Wessman on 28 Apr 2012, 1:43 p.m., in response to message #10 by Gilles Carpentier
Hmm... hopefully I didn't screw anything up so I will look foolish. It was 1:30 am my time. :-|
I retested with the exact source I have below just to make it as consistent as possible. Timing was done using 'Time(<progname>)' as the input where a time was required, and done using a check against the execution value where a manual stop was required.
The programming language on the 39gII is definitely an algebraic style language, but there is definitely influences from other places. It should be very easy and readable for just about anyone.
The NQueens was kept identical to the old "39gs" program basically as I wanted a comparison (~5m06s for those interested IIRC). I suspect it would go faster if modified to be a better structure.
EXPORT NQUEENS()
BEGIN
R:=8;
L1:=MAKELIST(0,X,1,R,1);
S:=0;
X:=0;
REPEAT
X:=X+1;
L1(X):=R;
REPEAT
S:=S+1;
Y:=X;
WHILE Y>1 DO
Y:=Y-1;
T:=L1(X)-L1(Y);
IF T==0 OR X-Y==ABS(T) THEN
Y:=0;
L1(X):=L1(X)-1;
WHILE L1(X)==0 DO
X:=X-1;
L1(X):=L1(X)-1;
END;
END;
END;
UNTIL Y==1 END;
UNTIL X==R END;
S;
END;
The addition loop can be done like this, (stopped at 1 min with ON/C).
EXPORT ADDLOOP()
BEGIN
A:=0;
REPEAT
A:=A+1;
UNTIL 0;
END;
Math test and trig test have 'wonderful' algebraic nesting... :-(
EXPORT MATHTEST(a)
BEGIN
T:=Ticks+1000*a;
N:=0;
A:=1012340;
B:=2.345;
REPEAT
SQRT(((((A*B)-B)/A)*B)/3.5);
N:N+1;
UNTIL Ticks>T;
N;
END;
EXPORT TRIGTEST(a)
BEGIN
T:=Ticks+1000*a;
N:=0;
REPEAT
e^LN(ATAN(TAN(ACOS(COS(ASIN(SIN(56.26)))))));
N:N+1;
UNTIL Ticks>T;
N;
END;
Also, I believe I was remembering the loop test value incorrectly last night. I am seeing around 640,000 right now after several runs.
With these exact sources, I get these results after 5 runs averaged. I assumed radians mode. Degree mode loses about 100 or so over a minute.
Math: 85389/679*100 = 12576
Trig: 15198/40*100 = 37995
Sp/$: (2*12576+37995)/80*100 = 78934
Addition Loop Test: ~640,000
NQueens: 1.32s
TW
Edited: 28 Apr 2012, 1:48 p.m.
|