Performance

From J2me wiki

Table of contents

Thread delay in run loop

Forum discussion (http://www.j2meforums.com/forum/index.php?topic=8106.0)

Synchronized

Synchronized methods are slow, since an object lock has to be obtained. Avoid them if you can.

Method parameters

The number of parameters passed into a method affects performance. If you can't remove a method, try to have a minimum number of parameters passed into it.

Bitshift operators

Bitshift operators are faster than multiplication and division operators.

Instead of:

x / 4

use

x >> 2

Instead of:

x * 4

use

x << 2

--> As if the compiler doesn't know this...

Loops

Leave as much code as possible outside loops.