- Joined
- Jun 12, 2010
- Messages
- 413
So, I just optimized my map and then decided to check if my code had been properly optimized where I wanted. However, I was pretty shocked to find that the optimzier does not optimize operations that will always yield the same result.
As you can see, 2*$C is clearly an optimizable operation that will always yield 24 ($18 in hexadecimal). However, the optimizer still leaves it as a costly JASS operation instead of changing it to a number. I thought this would be one of the first optimizations to be considered.
As you can see, the optimizer is correctly removing the constant variables in the code and replacing them with the actual value. I thought this might be the problem, maybe the optimizer was optimizing operations first and then replacing constants, but....
Even when the actual number is already written in the code, the optimizer will not optimize the operations.
So my question is, am I doing something wrong in the settings? If not, is there any optimizer out there that will take care of these predictable operations?
Thanks for your help.
JASS:
set DB[K3+2*$C]=DB[K3+2*$C]+$80
As you can see, 2*$C is clearly an optimizable operation that will always yield 24 ($18 in hexadecimal). However, the optimizer still leaves it as a costly JASS operation instead of changing it to a number. I thought this would be one of the first optimizations to be considered.
JASS:
set udg_save_XYminmaxcur[playerNumber+2*bj_MAX_PLAYERS] = udg_save_XYminmaxcur[playerNumber+2*bj_MAX_PLAYERS] + 128
As you can see, the optimizer is correctly removing the constant variables in the code and replacing them with the actual value. I thought this might be the problem, maybe the optimizer was optimizing operations first and then replacing constants, but....
JASS:
function IsDestructableTree takes destructable dest returns boolean
local boolean result = false
call BJDebugMsg((I2S(1+2)))
JASS:
function TW takes destructable UW returns boolean
local boolean WW=false
call BJDebugMsg((I2S(1+2)))
Even when the actual number is already written in the code, the optimizer will not optimize the operations.
So my question is, am I doing something wrong in the settings? If not, is there any optimizer out there that will take care of these predictable operations?
Thanks for your help.