miniquad icon indicating copy to clipboard operation
miniquad copied to clipboard

strange rate of draw calls on low-end hardware

Open TwilightFlower opened this issue 2 years ago • 2 comments

I wrote a simple program using miniquad, and sent it to my friend with a low-end computer running Windows 10. It was lagging some, which I wasn't too surprised by, so I started dummying things out. With everything in draw and update dummied out except for a basic function to print the FPS to console every second, it was only hitting ~35 fps. I tried simply putting the same counter code in a loop {...} and it got ~2 million iterations per second, so it seems to be some overhead within miniquad. I know there will be some overhead no matter what, but for not making any calls on Context this seems surprisingly high.

TwilightFlower avatar Jul 06 '22 21:07 TwilightFlower

The code I was using to count FPS, by the way:

struct FPSCounter {
	last_fps: u32,
	last_instant: Instant,
	frames: u32
}

impl FPSCounter {
	fn count_frame(&mut self) {
		let now = Instant::now();
		let elapsed = now - self.last_instant;
		if elapsed > SECOND {
			self.last_fps = self.frames;
			self.last_instant = now;
			self.frames = 0;
			println!("FPS: {}", self.last_fps);
		}
		self.frames += 1;
	}

	fn get_frames(&self) -> u32 {
		self.frames
	}

	fn new() -> Self {
		FPSCounter {
			last_fps: 0,
			last_instant: Instant::now(),
			frames: 0
		}
	}
}

TwilightFlower avatar Jul 06 '22 21:07 TwilightFlower

@TwilightFlower , to test under windows, you can calculate fps using hrstoptimer crate. I test the FPS is around 60.

skydig avatar Sep 17 '22 05:09 skydig