While - Wend code generation
Posted: Tue Nov 10, 2009 5:17 pm
I know it's something really microscopic, but anyway...
I saw the code generated for a loop like this
is this
wouldn't be better something like this ?
This way instead of an absolute jump and a conditional one inside the loop, we have only one conditional jump making the work of both and only one executed for loop.
Is less efficient of the original code only if the loop is never executed, certainly the less common scenario.
Unless I'm missing something ...
Bye!
EDIT: well, it's seem it will stay this way... no changes in the new PB version, I checked
I saw the code generated for a loop like this
Code: Select all
While k < 10
k + 1
Wend
Code: Select all
; While k < 10
_While1:
MOV ebx,dword [v_k]
CMP ebx,10
JGE _Wend1
; k + 1
INC dword [v_k]
; Wend
JMP _While1
_Wend1:
Code: Select all
JMP _WhileTest1
_While1:
; k + 1
INC dword [v_k]
; Wend
_WhileTest1:
; While k < 10
MOV ebx,dword [v_k]
CMP ebx,10
JL _While1
Is less efficient of the original code only if the loop is never executed, certainly the less common scenario.
Unless I'm missing something ...
Bye!
EDIT: well, it's seem it will stay this way... no changes in the new PB version, I checked
