[java] Byte code optimization

Started by
3 comments, last by Woody FX 18 years, 9 months ago
Hi guys, I have a game done thats working on some platforms. On others it wont run because the bytecode is too large. So i need to re-work the code to reduce the bytecode. I've been reading articles on it but still need more info. Can any of you give me a few more tips?
Advertisement
what now? Are we talking J2ME?

[Formerly "capn_midnight". See some of my projects. Find me on twitter tumblr G+ Github.]

Yes J2ME. I think it will take to take out vast chucks of code as my efforts so far havent yielded any joy on the phone.
Is it because there is too much code, or too much code+data ?

There are plenty of normal Java size optimisation methods - usually using some obfuscator such as Proguard, but also changing your source to make things more optimal.

Normally cutting size involves reducing the number of classes rather than just reducing the amount of code. Proguard I believe now inlines constants and removes unused classes, so you can put your constants in their own class, and that class will be removed entirely.

You should work out exactly why it doesn't work on specific platforms - does it load, does it run out of memory at runtime, or what?

Then try to address those specifically.

Mark
I can get it to load on the Panasonic X60 by removing code. At the moment there is just too much. It recompiles ur code before it installs to the phone. The jar is 77908 before it goes on the phone and 241437 after it has been installed.

So will see if there is any code i can remove.

This topic is closed to new replies.

Advertisement