Need for Speed - image creation & rendering

Hi,
I need any advice to squeeze more performance out of my application. My app receives a 2-d array of doubles, from which I need to create an image. It receives a new array once every second. This image is then continuously rendered (trying to maintain 30fps) to a JPanel, each frame scrolling down. (i.e. to represent a top-down view of the ground scrolling by).
I am currently converting the 2-d array of doubles to a 2-d array of int pixels, then create a BufferedImage (TYPE_INT_ARGB) and call setRGB with the int array.
Then another thread is calling repaint() which scrolls the image at the desired fps. From what I can gather from this forum is that I may not be getting accelerated images, and that would greatly increase the painting of the image each frame. Is there a way to create an accelerated image from this int array (as opposed to loading it from a file)?

Any help is appreciated,

Cory

First off, try doing active rendering instead of calling repaint. You might want to take a look at using BufferStrategy as well, especially if this is a full screen app. Lastly, use Component.createImage() or GraphicsConfiguration.createCompatibleImage(), since these methods create buffered images that can be accelerated (also called “Automatic Images” by some of the folks on this board).

Also, you might try to profile your app by using the -Xprof switch to make sure what the bottlenecks are.
Maybe the array of doubles and conversion to ints is expensive for example.

Erik

Thanks for your help! Once I switched to active rendering, and used VolatileImages, my framerate jumped to ~250 fps!
Thanks again, this forum is great, I wish I would have found it sooner.

Cory