No, you sound like an informed individual smile.gif. It's true, that java isn't nearly as slow as it used to be. However the garbage collection still has many problems with memory-intensive applications. Java can be programmed memory-smart, but at the cost of that trademark clearness. Sometimes it's just easier for everyone that you have destructors and a delete command as opposed to "I do it when I get around to it" garbage collector and finalizers.
I really have to agree with you here. Quite often I've wished that I had a way to manually delete objects - and actually, entire classes.
Sometimes I won't be using a class anymore(ex: a settings file loader), and I want to turf it out of memory. Currently I just have to hope the JVM will garbage it at some point. :lol:
dj51d said:
I'm a Java developer by trade, and I definitely agree with you that JVM performance isn't typically much of an issue these days. In large part, this is due to the continual improvement of the JIT. While the JIT is maintined on x86 and SPARC, I'm not sure if there is a version targeting ARM which means we may only have an interpreted JVM for the Pandora.
Java's garbage collection model can of course, be both a blessing and a curse. 20 second pauses for a full mark-sweep collection are not a good thing in a web application. I've found that while you can gain some significant improvement through tuning the VM parameters, garbage collection certainly doesn't save you from your own mistakes(not that you stated or even implied that it does, but people often end up thinking garbage collection means you don't have to worry about memory management).
Your post was packed with goodness.
Java on x86 is incredibly fast - perhaps even faster than C, in some cases.
I needed some auto-resizing arrays for something, so my first thought was to use ArrayLists. I wrote a wrapper class that ensures the ArrayList boosts its capacity adequately, so that wouldn't constantly be resizing the entire array. Then I got curious... would an ArrayList coded in java be faster than a library ArrayList? I rewrote the class in java, how I envisioned an ArrayList to be coded, and included chunk-resizing that matched the ArrayList+wrapper.
It ended up about 40% faster than the library ArrayList for
get(), and 100% faster for
add(); the tradeoff was it was locked to a single type of object. I can't remember exact numbers, but it almosted halved the time taken by a sorting algo.
I believe we will be limited to interpreted Java on the Pandora - unless something happens with Mono. Still, interpreted isn't bad - JamVM's 100% interpretation seems to perform better than both Cacao and Kaffe.
Sun's ARM JVM is Headless, and seems to have great performance, but it costs money to license it. I enquired to them about it, and unfortunately the price isn't low enough that it wouldn't affect the price.
One thing to remember about Java - you do have to consider heap fragmentation. If you're creating new objects all the time, find a better way to do something.
JamineBourne said:
4.) To me it appears that SDL is implemented in a bunch of languages, Java among them, so is there a difference between JSDL and SDLjava?
Since someone else answered the other three, I'll tackle #4.
-SDLJava is old and incomplete.
-JSDL is older and more incomplete.
JamineBourne said:
But I also just came across this: "LWJGL" I was interested when I saw the tutorial that wrote a space invaders game in java, then changed it to JOGL, then changed it to LWJGL. Would this be a better option, or is OpenGL not supported by the pandora? (not OpenGL ES)
I also looked into this. I talked with some of them on the IRC channel, and determined that getting LWJGL to work on the Pandora will be fairly difficult. First, it has some dependancies that have to be met:
-It works on top of AWT/Java2D, but with hardware acceleration. The first task is getting regular java stuff to run on the Pandora like any other app.
-The second task is recompiling the lwjgl DLLs to take advantage of the Pandora's hardware. It can use OpenGL, but not OpenGL ES, so this will be a massive task.
General consensus was, SDLJava would be easier to fix up.
And getting AWT working, then jumping right to OpenGL ES, might be even easier.