I agree with Abuse on that. But my final static in interface mentionned earlier are inlined by the obfuscator, so it's just clarity there..
Btw, switch is costier than if.. if.. if..
Abuse, do you know a good website or book so I can learn more about the fascinating world of the java-bytecode conversion? (especially generated bytecode cost).
I have severals hypothesis on certains fines points..
Anyway, just to help, here are some classic tips straight out of my head at this early time:
- Make use of default value in properties initialization as much as possible (int = 0, boolean = false, object = null etc...). It will reduce by a few bytes for each properties.
- If you really need to have a propertie instead of a local var, making them static will save a few bytes too.
- Private/public doesn't make a difference in bytecode generated.
- Try.. Catch() is expensive, use a "global" Try.. Catch() instead of severals small ones.
There are many more, but now I have trouble remembering them all
I have to grab my bicycle and go to work