Open TwilightFlower opened 2 years ago
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 , to test under windows, you can calculate fps using hrstoptimer crate. I test the FPS is around 60.
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
andupdate
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 aloop {...}
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 onContext
this seems surprisingly high.