Un Test Suplemetaire .
Publié : ven. 07/août/2009 13:57
Rajout de While Wend.
Ce qui donne :
Configuration
XP
Intel Core Duo E6850 3.00 Ghz
4 Go de Ram
(36 Processus en cours et 430 mo de pris)
;====================
; ASM = 328
; ASM Repeat = 1 472
; REPEAT = 2 344
; FOR NEXT = 1 937
; WHILE WEND = 1 922
;====================
Je réitére ma demande sur comment utiliser la code ASM pour incremeter une variable pendant la boucle ?
Il serait ainsi pratique de comparer les boucles avec un petit calcul ensuite .
+
Code : Tout sélectionner
;==========================
; Test by Mytic
;==========================
;
DisableDebugger
; !!! désactivez le débogueur avant !!!
max = 999999999
;=================================(ASM)============================
Delay(1000)
t.d = ElapsedMilliseconds()
a.l = 0
!PUSH Eax
!PUSH Ebx
!MOV Eax,[v_a]
!MOV Ebx,[v_max]
!LP1:
!INC Eax
!CMP Eax,Ebx
!JNE LP1
!MOV [v_a],Eax
!POP Ebx
!POP Eax
S1.d = ElapsedMilliseconds()-t
;MessageRequester("ASM",StrD(S1))
;=================================(Semi ASM/PB!)============================
Delay(1000)
t.d = ElapsedMilliseconds()
a.l = 0
!PUSH Eax
!MOV Eax,[v_a]
Repeat
!INC Eax
!MOV [v_a],Eax
Until(a=max)
!POP Eax
S2.d = ElapsedMilliseconds()-t
;MessageRequester("Semi ASM/PB!",StrD(S2))
;=================================(PB REPEAT UNTIL!)========================
Delay(1000)
t.d = ElapsedMilliseconds()
a.l = 0
Repeat
a+1
Until(a=max)
S3.d = ElapsedMilliseconds()-t
;MessageRequester("PB!",StrD(S3))
;=================================(PB FOR NEXT!)============================
Delay(1000)
t.d = ElapsedMilliseconds()
a=0
For a=1 To max
Next a
S4.d = ElapsedMilliseconds()-t
;MessageRequester("PB!",StrD(S3))
;=================================(PB WHILE WEND!)==========================
Delay(1000)
t.d = ElapsedMilliseconds()
a = 0
While Not (a=max)
a+1
Wend
S5.d = ElapsedMilliseconds()-t
;============================( Conclusion )
R$ = "ASM = " + Str(S1) + #CRLF$ + "ASM Repeat = " + Str(S2) + #CRLF$ + "Repeat Until = " + Str(S3) +#CRLF$ + "For Next = " + Str(S4) +#CRLF$ + "While Wend = " + Str(S5)
MessageRequester("Comparaison",R$)
; IDE Options = PureBasic 4.30 (Windows - x86)
; CursorPosition = 46
; FirstLine = 29
Ce qui donne :
Configuration
XP
Intel Core Duo E6850 3.00 Ghz
4 Go de Ram
(36 Processus en cours et 430 mo de pris)
;====================
; ASM = 328
; ASM Repeat = 1 472
; REPEAT = 2 344
; FOR NEXT = 1 937
; WHILE WEND = 1 922
;====================
Je réitére ma demande sur comment utiliser la code ASM pour incremeter une variable pendant la boucle ?
Il serait ainsi pratique de comparer les boucles avec un petit calcul ensuite .
+