Code : Tout sélectionner
x0 = (complexWidth * i / screenSize - (complexWidth/2.0))
Code : Tout sélectionner
; x0 = (complexWidth * i / screenSize - (complexWidth/2.0))
FLD qword [v_complexWidth]
FIMUL dword [v_i]
MOVZX eax,word [v_screenSize]
MOV dword [rsp-4], eax
FIDIV dword [rsp-4]
FLD qword [v_complexWidth]
FDIV qword [D3]
FSUBP st1,st0
FADD qword [D4]
FSTP qword [v_x0]
Mon code a moi :
Code : Tout sélectionner
EnableASM
FLD complexWidth ; st0 = complexWidth
FIMUL i ; st0 = complexWidth * i
FIDIV screenSize ; st0 = complexWidth * i / screenSize
FLD complexWidth ; st0 = complexWidth ; st1 = complexWidth * i / screenSize
FLD1 ; st0 = 1 ; st1 = complexWidth ; st2 = complexWidth * i / screenSize
FLD1 ; st0 = 1 ; st1 = 1 ; st2 = complexWidth ; st3 = complexWidth * i / screenSize
FADDP ; st0 = 2 ; st1 = complexWidth ; st2 = complexWidth * i / screenSize
FDIVP ; st0 = complexWidth / 2 ; st1 = complexWidth * i / screenSize
FSUBP ; st0 = complexWidth * i / screenSize - complexWidth / 2
FSTP x0
DisableASM
Ce n'est pas la partie la plus critique du code et je perd plus de 20% en performance
J'ai merdé ou ?
La difference entre les 2 code ne me semble pourtant pas monstrueuse...