0 Members and 2 Guests are viewing this topic.
Yeah, there's no point in doing that for multiplication unless the numbers are larger than the auto-opt numbers, in which case its no longer optimized for size.I guess another trick is leaving out arguments that are already duplicated. For instance, Output(0,0,Str1) can be optimized to Output(0,,Str1) since the second argument does not need to be changed from the first argument. Similarly, Output(0,1,Str1) can be optimized to Output(0,+1,Str1) which is kinda similar to the close variable loading optimization. There are many more variates of this trick you can use on a lot of commands. Its especially helpful with Copy() and Exch()
This entire thread is should ONLY be optimizations to the executable. There would be no reasons to make source code "optimizations" becasue its irrelevant to the final product. In fact, larger source code often leads to better readability and organization which is why I almost always cap my end parenthesis, leave comments, and sometimes indent when I've got a lot of nested blocks.
Instead ofIf A=Bdo!If A-BAnd instead ofIf A!=BdoIf A-BThis optimization takes advantage of the fact that the If statement checks for non-zero and !If checks for zero. No speed/space is wasted on the boolean expressions returning just a 0 or 1.
HoMM: [==--------] Project 'resumed': I'm suffering overwhelming new ideas being popped up in my dreams :PtiDE: [----------] Explored and understood the main part of the code: just started writing a Tokenizer.
A question: is it quicker to store into Ans, since it is a register, or to a local variable like just A?
oh, because it has to be converted to basic type number when you store into Ans?