Why should I optimize the applet code?
There are three main reasons why you have to optimize your code:
- Resources are extremely constrained. EEPROM size typically is 32Kb, and is used to hold post-issuance applets as well as application data. RAM size is usually about 2Kb, and must accommodate for application stack, transient data and the APDU buffer. You just can't afford any waste.
- Processing power is very limited: the chip usually holds an 8-bit CPU running at 5MHz. Also, Java Card applets are much slower than native code, so you don't want to perform unnecessary operations.
- Even though your applet runs fine on your platform, you still want to save as much resources as possible, so that it will also run on more limited platforms (less stack, smaller transaction buffer, etc). WORA, remember?