Difference between revisions of "Code Size/Cheat sheet"
(cheaet-sheet for small codesize; still stubs) |
m (minor changes) |
||
Line 86: | Line 86: | ||
| style="margin:0; background:#e0efef; border:1px solid #a3bfb1; font-weight: bold; text-align:left; color:#000; padding:0.1em 0.4em;" | A magic of register | | style="margin:0; background:#e0efef; border:1px solid #a3bfb1; font-weight: bold; text-align:left; color:#000; padding:0.1em 0.4em;" | A magic of register | ||
|- | |- | ||
− | |style="text-align: | + | |style="text-align:justify"| |
− | Every operation to anything must be done from register. Java has 4 registers to hold variable. | + | Every operation to anything must be done from register. Java has 4 registers to hold variable. If the method is not static, the first one is <code>this</code> reference. The remaining registers will be use for each parameter and variable inside method. Every type of variable use 1 register, except double use 2. When 3 registers are already used by other variable, a double value will then be assigned an extra register (and the codesize is as if there was only 1 used). If you do any operation on any variable that is not on the register, Java will need to move that variable to the register before doing any of your operation, which costs codesize. This mean you should define most-used variables before any other variables. |
Do this: | Do this: |
Revision as of 01:52, 5 May 2009
This article is a stub. You can help RoboWiki by expanding it. |
Code Size Cheat sheet
|
|