Page 1 of 3

benchmark ti

Unread postPosted: 05 Nov 2007, 16:28
by charognard
à des fins de bench j'ai fais des petits programmes (plus de dix)
sur diverses Plates formes mais pas TI.

je cherche donc (ayant revendu ma 89) que quelqu'un m'adapte ces petits dev sur 89, voyage et autre et me donne les temps passés ou les résultat.

Programme numéro 1
précision des calculs
10 A=1/3 :B=0 :C=0 :DIM D$(0)*30
20 D$(0)=STR$ A
30 A=1/3-VAL D$(0)
40 A=A*10
50 B=B+1
60 IF INT A A GOTO 40
70 A=VAL D$(0)
80 A=A*10
90 C=C+1
100 IF INT A A THEN 80
110 PRINT « Calcul interne : »
120 PRINT B ; « chiffres (» ;B/2+2 ; « bits)»
130 PRINT « Calcul stocké : »
140 PRINT C ; « chiffres (» ;C/2+2 ; « bits)»

Programme numéro 2
profondeur de pile gosub et for next
10 ON ERROR GOTO 50
20 B=0
30 B=B+1
40 GOSUB 30
50 PRINT « PILE GOSUB :» ;B
60 ON ERROR GOTO 110
70 B=0
80 B=B+1
90 FOR A=1 TO 2
100 GOTO 80
110 PRINT « PILE FOR … NEXT » ;B

Programme numéro 3
Taille maxi variables alpha-numérique
10 A=0
20 B$= « »
30 B$=B$+ « * »
40 A=A+1
50 IF LEN B$=A THEN GOTO 30
60 PRINT « Longueur maxi : » ; A-1

passons au test de rapidité de calcul maintenant
Test 1
Log, et logique
10 FOR A=1 TO 1000
20 B=255
30 H=B AND 240
40 GOSUB 100
50 L=B AND 15
60 NEXT A
70 PRINT "FIN"
80 END
100 D=0:IF H THEN LET D=LN H/LN 2
110 IF INT D=D THEN LET H=INT R+2^(INT D-4):RETURN
120 R=R+2^(INT D-4)
130 E=2^INT D:H=H-E
140 GOSUB 100
150 RETURN


Test 2
Graphique
5 WAIT 0
10 CLS
20 PRINT "SCORE:"
30 LINE (69,0)-(69,30)
40 LINE (145,0)-(145,30)
50 LINE (70,0)-(144,3),BF
60 LINE (70,6)-(144,9),BF
70 SC=0
80 BX=106
90 Y=10:OX=0:OY=Y:RX=-3:RY=2:X=109
100 LINE (70,30)-(144,30)
110 X=X+RX:Y=Y+RY
120 IF X70 OR X142 BEEP 1,10,10:RX=-RX:X=X+2*RX
130 IF Y=30 OR Y=-2 THEN BEEP 1,20,10:RY=-RY:Y=OY+RY
150 IF POINT (X,Y)=0 THEN 200
160 BEEP 1,10,10
170 SC=SC+5: IF SC200 THEN PRINT "FIN": END
180 LINE (X,Y)-(X+2,Y+1),R,B
190 Y=Y-RY:RY=-RY
200 LINE (OX,OY)-(OX+2,OY+1),R,B
210 LINE (X,Y)-(X+2,Y+1),B
220 OX=X:OY=Y
230 GOTO 110

info dans l'instruction line R eteint les pixel, B (box) et BR (box plein)

Limite : optimisation totalement permise dans les limite de rester en language interprété.

pour exemple une adaptation sur HP.
« ERASE
{ # 0d # 0d } PVIEW
PICT
{ # 0d # 0d } "SCORE:0" 1 GROB REPL
{ # 49d # 0d } { # 49d # 30d } LINE
{ # 125d # 0d } { # 125d # 30d } LINE
{ # 50d # 0d } { # 124d # 1d } BOX
{ # 50d # 2d } { # 124d # 3d } BOX
{ # 50d # 6d } { # 124d # 7d } BOX
{ # 50d # 8d } { # 124d # 9d } BOX
0 # 86d # 10d DUP DUP # 0d 2 -3 # 89d
- sc bx y yb oy ox ry rx x
« { # 50d # 30d } { # 124d # 30d } LINE
DO
x B-R rx + R-B 'x' STO
y B-R ry + DUP R-B 'y' STO 'yb' STO
IF x B-R 50 x BR 124 OR THEN
800 .05 BEEP
rx NEG 'rx' STO
x B-R 2 rx * + R-B 'x' STO
END
IF y B-R 30 = yb -2 == OR THEN
300 .05 BEEP
ry NEG 'ry' STO
oy B-R ry + R-B 'y' STO
END
IF x y 2 LIST PIX? THEN
300 .1 BEEP
sc 5 + 'sc' STO
PICT { # 22d # 0d } sc 1 GROB REPL
x y 2 LIST x 2 + y 2 LIST
x y 1 + 2 LIST x 2 + y 1 + 2 LIST
TLINE
TLINE
y B-R ry - R-B 'y' STO
ry NEG 'ry' STO
END
ox oy 2 LIST ox 2 + oy 2 LIST
ox oy 1 + 2 LIST ox 2 + oy 1 + 2 LIST
x y 2 LIST x 2 + y 1 + 2 LIST
BOX
TLINE
TLINE
x 'ox' STO
y 'oy' STO
UNTIL 'sc200'
END
»
»

le reste à suivre quand j'aurais déjà quelques résultat

Re: benchmark ti

Unread postPosted: 05 Nov 2007, 16:47
by tama
C'est quel langage ça ?
du basic ?

Re: benchmark ti

Unread postPosted: 05 Nov 2007, 16:51
by charognard
tama wrote:C'est quel langage ça ?
du basic ?


le premier c'est du basic.
le deuxième c'est du RPL (bref de l'HP), je sais ça fout les jetons la première fois :D:

Re: benchmark ti

Unread postPosted: 05 Nov 2007, 18:21
by charognard
Mic wrote:Uhm je comprends pas trop la syntaxe HP avec le $.
Sinon il existe des programmes de bench pour TI.

le $ ????, veux tu parler du # (le mode base)
en vérité les nombres sont stockés en plusieur mode #10d n'est pas égale à 10 et tu passes d'un systeme à l'autre par RB ou l'inverse
vu que je veux comparer avec plein d'autre ordi de poche
les bench spécial TI ne me conviennent pas .... normalement

Re: benchmark ti

Unread postPosted: 05 Nov 2007, 18:35
by tama
Prenons un code : clui là par exemple :

Test 1
Log, et logique
10 FOR A=1 TO 1000
20 B=255
30 H=B AND 240
40 GOSUB 100
50 L=B AND 15
60 NEXT A
70 PRINT "FIN"
80 END
100 D=0:IF H THEN LET D=LN H/LN 2
110 IF INT D=D THEN LET H=INT R+2^(INT D-4):RETURN
120 R=R+2^(INT D-4)
130 E=2^INT D:H=H-E
140 GOSUB 100
150 RETURN


C'est pas possible que tu rajoutes des commentaires pour expliquer ?

Re: benchmark ti

Unread postPosted: 05 Nov 2007, 18:50
by charognard
tama wrote:Prenons un code : clui là par exemple :

C'est pas possible que tu rajoutes des commentaires pour expliquer ?

c'est simplement des instructions de base BASIC.
j'ai utilisé dans c'est programmes que des instructions standards

but du programme
un simple convertisseur décimal -- hex utilisant des formules log pour arriver à ces fins.
et me servant de bench sur diverses caltoches
bref on converti 1000 fois la valeur deci 255 en FF et on mesure le temps

Re: benchmark ti

Unread postPosted: 05 Nov 2007, 19:01
by tama
oui mais basic!=TI-Basic
tu peux pas expliquer ligne par ligne ?

Re: benchmark ti

Unread postPosted: 05 Nov 2007, 20:09
by charognard
10 FOR A=1 TO 1000 ;debut de la boucle for next
20 B=255 ;255--B
30 H=B AND 240 ;ET binaire entre B et 240 on stocke le tout dans H
40 GOSUB 100 ;Allez au sous programme ligne 100
50 L=B AND 15 ;ET binaire entre B et 15 on stocke tout dans L
60 NEXT A ;fin de la boucle for next
70 PRINT "FIN" ;affichage de FIN
80 END ;fin du programme
100 D=0:IF H THEN LET D=LN H/LN 2 ; 0--D si H0 alors D=LN H/LN2
110 IF INT D=D THEN LET H=INT R+2^(INT D-4):RETURN ;condition de sortie de la boucle récursive
120 R=R+2^(INT D-4) ;calcul de R
130 E=2^INT D:H=H-E ;calcul de E et H
140 GOSUB 100 ;appel récursif
150 RETURN ;Retour du sous programme

voilà

Re: benchmark ti

Unread postPosted: 05 Nov 2007, 20:27
by tama
prgmMAIN
For A,1,1000
255-B
B and 240-H
prgmSUB
B and 15-L
End
Disp "FIN"
Return


prgmSUB
0-D
If D!=0
ln(H)/Ln(2)-D
If not(fPart(D
Then
int(R+2^(int(D-4-H
Return
End
R+2^(int(D-4-R
2^(int(D-E
H-E-H
prgmSUB
Return


par contre je suis pas sûr de la traduction...

Re: benchmark ti

Unread postPosted: 05 Nov 2007, 20:51
by charognard
prgmMAIN
For A,1,1000
255-B
B and 240-H ;es ce un And binaire, ça devrait donner 240 normalement et pas 1
prgmSUB
B and 15-L
End
Disp "FIN"
Return


prgmSUB
0-D
If H
ln(H)/Ln(2)-D
If not(fPart(D
Then
int(R)+2^(int(D)-4-H
Return
End
R+2^(int(D)-4-R
2^(int (D)-E
H-E-H
prgmSUB
Return

voilà ça devrait etre bon
maintenant il me faudrait le temps passé