[Solved] Major FPS drop with bullets

Hi

In my project, the user is able to run around, and shoot and kill entities that are chasing it. However, when the user starts to shoot while moving (or even standing still sometimes), the FPS drops from 200 to barely 60. Now, there are still tons of features to be added, so 60 fps now isn’t good at all. Here is how I render by bullets (and check if another one should be ‘shot’):


   for(Bullet bullet : bullets){
			bullet.update(this);
			bullet.render();
		}
		// Check for the user shooting
		Mouse.poll();
		if(Mouse.isButtonDown(0) && System.currentTimeMillis() - lastShot > delay){
			lastShot = System.currentTimeMillis();
			Vector2f player = screen.getPosition(); // Get the player's location
			Vector2f mouse = screen.getRealMouse(); // Get the mouse's location
			float dx = mouse.getX() - player.getX();
			float dy = mouse.getY() - player.getY();
			double angle = angleFromDirection(dx, dy);
			bullets.add(new Bullet(Color.RED, player.x, player.y, 2.0f, angle));
		}

And here is my bullet class:


package warlord.ingame.world;

import static org.lwjgl.opengl.GL11.*;

import java.awt.Color;
import java.awt.Rectangle;

import warlord.opengl.MathHelper;

public class Bullet {
	
	// Constants
	public static final int SIZE = 10;
	
	private Color color;
	private float x, y;
//	private ArrayList<float[]> oldCoordinates;
	private float velocityX, velocityY;
//	private long ticks;
	private Rectangle region;
	private boolean disposed;
	
	public Bullet(Color color, float x, float y, float velocity, double angle){
		this.color = color;
		this.x = x;
		this.y = y;
//		ticks = 0L;
//		oldCoordinates = new ArrayList<float[]>();
		velocityX = (float) (velocity * MathHelper.cos((float)angle));
		velocityY = (float) (velocity * MathHelper.sin((float)angle));
		disposed = false;
		region = new Rectangle(Math.round(x - 8.0f), Math.round(y - 8.0f), SIZE, SIZE);
	}
	
	public Rectangle getRegion(){
		return region;
	}
	
	public void update(Block block){
		if(disposed){
			return;
		}
		x += velocityX;
		y += velocityY;
		region.x = Math.round(x);
		region.y = Math.round(y);
		if(x < 0 || y < 0 || x > block.getWidthInTiles() * 51.0f || y > block.getHeightInTiles() * 51.0f){
			disposed = true;
		}
	}
	
	public void render(){
		if(disposed){
			return;
		}
		float x_ = x - SIZE, y_ = y - SIZE;
		glColor4f(color.getRed() / 255.0f, color.getGreen() / 255.0f, color.getBlue() / 255.0f, 1.0f);
		glBegin(GL_QUADS);
			glVertex2f(x_, y_);
			glVertex2f(x_ + SIZE, y_);
			glVertex2f(x_ + SIZE, y_ + SIZE);
			glVertex2f(x_, y_ + SIZE);
		glEnd();
		glColor3f(1.0f, 1.0f, 1.0f);
	}
	
}

I hope someone can help me figure out why there is such a steep FPS drop :frowning:

CopyableCougar4