Abt. Der flinke Alte: xpse
=================
Mit einigen Untergriffen und Kniffen ist der Profan-Preprozessor xpse auch bei X3 noch am Rennen, gedacht ist er aber für XProfan-11. Naja, 17 mal schneller hat schon was... Hier ein 3D-Floatingpoint-Array, das im Programmtext mit beliebigen Seitenlängen definiert werden kann (bis der Rechner platzt) und das aufsummiert werden soll, etwa für eine sog. Z-Normierung.
Gruss
{$CLEQ} 'xpse-code
WindowTitle " X P S E - S p e e d t e s t "
'(D) Demo 2016-08 by P.Specht. OHNE JEDWEDE GEWÄHR!
Cls:font 2:declare z&,s&,t&
'3D-Testarray: Zeile, Spalte, Tiefe
z&=300
s&=300
t&=300
declare array![z&-1,s&-1,t&-1],ad&,tm&
Print "\n Es läuft die konventionelle Vorbelegung eines großen 3D-Arrays ..."
tm&=&GetTickCount
array![]=1
' Testwert, ob Zeile,Spalte,Tiefe in richtiger Reihenfolge
array![1,3,2]=2
print "\n Konventionelle Vorbelegung in ";int(&GetTickCount-tm&),"ms"
print
ad&=addr(array![0,0,0])
print " Einige Infos:"
print " Memory-Adresse des als fest deklarierten 3D-Floatarrays:",ad&
print " Ist der Testwert = 2 ?: ";float(ad&,8*(1+z&*(3+s&*2)))
print " Das 8byte-Float-Testarray hat ";int(z&*s&*t&);" Elemente"
print " und nimmt dabei",z&*s&*t&*8/1024/1024,"MB Speicher ein."
print
print
Print " Zum Vergleich nun die Vorbelegung mit XPSE ..."
tm&=&GetTickCount
print " Das Array wurde vorbelegt mit dem Wert ";Vorbelegen(z&,s&,t&,ad&,1.0)
array![1,3,2]=2
print " mittels XPSE in ";int(&GetTickCount-tm&),"ms"
print
print " R E C H E N T E S T \n"
tm&=&GetTickCount
print " ERGEBNIS = ";Summe(z&,s&,t&,ad&)
print " mit XPSE in ";&GetTickCount-tm&,"ms ermittelt."
print
print " Die gleiche Berechnung läuft nun mit dem Token-Compiler von Profan."
tm&=&GetTickCount
print " ERGEBNIS = ";Summ(z&,s&,t&,ad&)
print " Mit Profancompiler ermittelt in ",(&GetTickCount-tm&)/1000,"s"
print "\n Danke für Ihre Geduld! E N D E "
sound 1000,100:waitinput 30000:end
nproc Summe :parameters z&,s&,t&,ad&
declare sum!,i&,j&,k&
sum!=0
whileloop 0,z&-1:i&=&Loop
whileloop 0,s&-1:j&=&Loop
whileloop 0,t&-1:k&=&Loop
sum!=sum! + float(ad&,8*(i&+z&*(j&+s&*k&)))
endwhile
endwhile
endwhile
return sum!
endproc
'float(ad&,8*(1+z&*(3+s&*2)))
nproc Vorbelegen :parameters z&,s&,t&,ad&,wert!
declare i&,j&,k&
whileloop 0,z&-1:i&=&Loop
whileloop 0,s&-1:j&=&Loop
whileloop 0,t&-1:k&=&Loop
Setfloat(ad&, 8*(i&+z&*(j&+s&*k&)),wert!)
endwhile
endwhile
endwhile
return wert!
endproc
proc Summ :parameters z&,s&,t&,ad&
declare sum!,i&,j&,k&
sum!=0
whileloop 0,z&-1:i&=&Loop
whileloop 0,s&-1:j&=&Loop
whileloop 0,t&-1:k&=&Loop
sum!=sum! + array![i&,j&,k&]
endwhile
endwhile:print "*";
endwhile:print " ";
return sum!
endproc
Alles anzeigen