Quote:if you are using object oriented programming languages you don´t think about optimisation ..
I don't want to sound rude, but thats bullcrap. Of course a well written java app will perform much better than a badly written java app, and that is what the OP is asking. Saying that all hope is lost because its an OO language so to not think about optimization is the craziest thing I've heard. There are plenty of java (& processing) apps out there that perform perfectly at the level required. Of course they could perform faster if the same algorithms were coded in C. But that doesn't mean don't bother writing efficient java code!
E.g., some VERY basic examples off the top of my head that might be of some use to anyone interested in optimizing their code:
using vertex buffers is a lot faster than calling glvertex thousands of times (and so can be the old school display lists)
To see if two points are within a certain distance of each other, its quicker to check the square of the distance as opposed to the actual distance (if(p1.x*p1.x+p2.x+p2.y < dist*dist) instead of if(sqrt(p1.x*p1.x+p2.x+p2.y < dist) );
Divisions are slow, if you have loops with millions of divisions per second, try and cache the reciprocal of the divisor and replace them with multiplications (e.g. *0.2 instead of /5);
In opengl, changing the state of something has overheads, even if the state isn't changing (i.e. putting glEnable(GL_BLEND) in a for loop and enabling it hundreds of times a frame when it can be enabled once, then looped, will improve performance);
Similar to above, binding a texture once, then drawing thousands of particles will be much faster than binding, drawing, unbinding for each particle;
String concatenations are slow, so try not to do them in massive loops, use StringBuffer if you must;
in opengl, having depth testing turned ON can improve graphic performance drastically if you are drawing a lot to the screen, and a lot of what is being drawn is supposed to be behind other stuff
Try to avoid resizing arrays a lot, it can be a lot quicker to set them to the max size you think you'll need up front,
etc.. the list is huge and goes on... and none of the above have big impact on readability. Of course C can perform faster than java... but that doesn't mean you shouldn't think about optimization when using OO!