# How can I improve my rendering performance in Java?

How can I improve the performance of my rendering? Currently, I'm rendering with java.awt.Graphics, but it seems to be starting to slow down since I'm adding new stuff to render.

My rendering setup:

Loading a spritesheet: Spritesheet sheet = new Spritesheet(ImageLoader.loadImage("/textures/spritesheet.png"));

Loading sprites: BufferedImage player = sheet.crop(5, 0, Spritesheet.DEF_WIDTH, Spritesheet.DEF_HEIGHT);

And then rendering it with java.awt.Graphics in my gameloop: g.drawImage(player, x, y, Entity.DEF_WIDTH, Entity.DEF_HEIGHT);

Spritesheet.DEF_WIDTH and Spritesheet.DEF_HEIGHT refer to 32px for quick access since most of my sprites are 32x32px. Entity.DEF_WIDTH and Entity.DEF_HEIGHT refer to 64px to render the entity on the screen.

One way I know that could solve my problem is that I could use smaller sprites but scale them up while rendering, but let's see if it's possible without that first.

• Completely understand. I think I'm going to make my sprites smaller and scale them when drawing them to the screen. And, when doing a new project, I'll keep in mind to try out a third-party API. Thanks for your help! – Kerdo Feb 24 '18 at 18:50
• You sure you're using java.awt.graphics correctly? Im not sure if scaling helps in this case. – Sidar Feb 24 '18 at 19:37