ich hab mal wieder ein Problem das mich schon mehrere Tage beschäftigt

Mein Problem ist, das ich eine schnellere Modulo-Funktion bräuchte ...
Meine Idee war die Modulo Funktion selbst zu schreiben:
ca. so: (zahl1/zahl2-Int(zahl1/zahl2))*zahl2
und hier mein PB-Test-Proggi

Code: Alles auswählen
NewList MyList.l()
For i.l = 1 To 10000000
AddElement(MyList())
MyList() = i
Next
; PureBasic-Modulo-Funktion-Funktionstest
temp.l = 0
ResetList(MyList())
puretick.l = GetTickCount_()
For i.l = 1 To CountList(MyList())
NextElement(MyList())
temp = (MyList() % 13)
Next
; Meine-Modulo-Funktion-Funktionstest
temp.l = 0
ResetList(MyList())
mytick.l = GetTickCount_()
For i.l = 1 To CountList(MyList())
NextElement(MyList())
f1.f = MyList() / 13
temp = (f1-Int(f1))*13
Next
MessageRequester("Ergebnis","PureBasic-Modulo-Funktion: " + Str((GetTickCount_() - puretick)) +"msec." + #CRLF$ + "My-Modulo-Funktion: " + Str((GetTickCount_() - mytick)) +"msec.")
Hier meine Ergebnisse:
Athlon XP +1800 (1.54Ghz)
512 MB Ram
Windows XP
Test 1:
PBModulo: 1250msec.
myModulo: 640msec.
Test 2:
PBModulo: 1266msec.
myModulo: 641msec.
Test 3:
PBModulo: 1297msec.
myModulo: 688msec.
Dell PowerEdge 1420
1GB Ram
Windows Server 2003 Standard
Test 1:
PBModulo: 703msec.
myModulo: 437msec.
Test 2:
PBModulo: 688msec.
myModulo: 422msec.
Test 3:
PBModulo: 703msec.
myModulo: 437msec.
gruß Markus