Performance in 1.1

Greetings fellow Java programmers! Although I have been writting Java games for more than a couple of years (and being a games programmer since the glorious days of Commodore 64), I never knew about this site until a month ago! I have gathered a number of performance questions and I’m really glad that this forum exists, so I can hopefully exchange opinions with some of you.

OK I have a number of questions that lie in the field of ‘Black Art’, so if you are an experienced Java programmer your input will be highly appriciated. Before I start, I should let you know that I am exclusively creating Java applets using 1.1 and my primary interest is the behaviour of the MS VM. So please, all you gurus out there limit your answers to these parameters.

Here we go:

  1. Would the Java compiler one uses, affect the quality or the performance of the compiled project? To be more specific, if you’re targeting for Java 1.1 and you use the latest Java compiler, is this good, bad or doesn’t matter? If you are primarily targeting for MS VM would it be better to use (sigh!) Visual J++?

  2. Obfuscation: Apart from any moral point of view, would it ever affect the performance? Do you know any obfuscators that work better than others?

  3. The -O parameter. I never see anyone use this parameter, so I have to ask: if a program is already optimized, would the use of the -O, mess things up?

  4. There was a time when the site gamebrew.com had posted a number of brilliant Java routines. Now they have completely removed the developer’s section. Has any of you kept these articles?

  5. Finally an Image question that is not directly related to performance, but deals with something that could potentially cause trouble in execution. Negative Coordinates: What happens when you use drawImage() on negative coordinates? Could this ever cause memory corruption?

That’s all! I’d like to thank you all for reading this, and please feel free to add your comments.

  1. Compiler choice usually has a minimal effect - VM used is usually much more influential.

  2. Never tried it myself. Rumoured to provide a speedup, but not sure how much…

  3. As far as I know, the optimise -O parameter has never actually done anything…

  4. Perhaps the way back machine could help you? A quick look shows the dev section seems to be avalible…

  5. Negative/invalid coords should be perfectly fine, pixels should be clipped to the target properly automagically.

  1. if you are compiling for 1.1, using javac 1.3+, you will need to use the compiler flag “-target 1.1” to make it generate class files compatible with <1.1.

  2. Obfuscation reduces class file size considerably, speed wise though, they tend to make little difference.
    (Having said that, most obfuscators also perform optimisations to your code as well, so you may get some benefit)

[quote]As far as I know, the optimise -O parameter has never actually done anything…
[/quote]
Well, it made your classes really big ;D
(but not any faster)

From what I heard is that -O was omitted because it worked counter effective for JIT optimizations (where the real optimization is).

Erik

I am currently in a project that has to use JDK 1.1.8.

Compiler doesn’t seem to make a difference, but JDK matters: We tried SUN 1.1.8 and IBM 1.1.8. IBM’s JDK seems to be faster in casting operations and overloading.

In UI things ther was nearly no difference.

As obfuscator, we tried jode which removes all debug code, encodes field names, etc. There was a slightly performance boost, but we just noriced it in a loop with more as 100.000 runs and numerous casting operations. Even then the boost was below 2% :-/

And -O parameter: Haven’t noticed any performance difference.