Optimizer
bon , je vais me lancerHow does this program work:
The new FAsm.exe represents the optimizer. The PB compiler calls it with the FAsm parameters. Now, it optimizes the PureBasic.asm and then calls the real FAsm (FAsm2.exe).
Results (for an unrealistic, good example (you can find it in the German forums)):
without Opt.: 5078ms (PB) versus 2453ms (Asm)
with Opt.: 2542ms versus 2532

ok je viens de dézipper la chose , ça semble intéressant
#####################################################################
########################### Optimizations ###########################
#####################################################################
© Copyright by Remi Meier
02.07.2005
Website: http://www.remimeier.ch.vu
#####################################################################
#### Cutting out unused procedures
Not all, but a lot of unused procedures will be removed from the ASM
source.
#### CDQ
Replaced by
MOV Edx, Eax
SAR Edx, 31
cause it is pipeable (chance for parallel processing of commands)
#### Remove CALLs of some PB procedures
The listed PB-Functions are replaced by their equivalent ASM code:
- PokeF()
- PeekF()
- PokeL()
- PeekL()
- PokeW()
- PeekW()
- PokeB()
- PeekB()
- CallFunctionFast()
- Red()
- Green()
- Blue()
- RGB()
#### IMUL replaced by faster code
A lot of multiplications will be replaced by faster code like:
Mul0011:
LEA ebx,[eax+eax*8]
ADD eax,eax
ADD eax,ebx
#### Subtracting of -Values
Ex:
MOV Edi,dword [v_n]
NEG Edi
SUB Ebx,Edi
->
ADD Ebx, Edi
#### Unneeded MOVs and PUSHs
MOV Ebx,dword [v_i2]
PUSH dword [v_e]
MOV Eax,Ebx
POP Ebx
->
MOV Eax,dword [v_i2]
MOV Ebx,dword [v_e]
#### Exchanging values of variables with use of a third
PUSH dword [v_a]
POP dword [v_c]
PUSH dword [v_b]
POP dword [v_a]
PUSH dword [v_c]
POP dword [v_b]
->
MOV eax,dword [v_a]
MOV ebx,dword [v_b]
MOV dword [v_b],eax
MOV dword [v_a],ebx
MOV dword [v_c],eax
#### Modulo with 2^n values like VAR % 64
MOV Ebx,dword [v_a]
MOV Eax,Ebx
MOV Ebx,2
CDQ
IDIV Ebx
MOV Ebx,Edx
MOV dword [v_b],Ebx
->
MOV eax,dword [v_a]
AND eax,1
MOV dword [v_b],eax
© Copyright by Remi Meier
02.07.2005
Website: http://www.remimeier.ch.vu