Hello there,
after I played around with my layout engine I managed to get a good boost from 149 fps to 512. But even after optimizing more I did not get more fps. Then I tested an empty project which did nothing but print the fps to screen (with disabled vsync). This empty screen got between 509 and 512 fps.
So now I am wondering: Is there a cap at 512 fps? I tested it on my most powerful machine so I cant tell if it possible to go higher. If so, why?
I am not even talking about gameplay aspects now, but for benchmarking my routines a cap would not be the best situation. Or is it just a coincidence?
Greetings
uiblob
512 FPS?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
-
- Party member
- Posts: 234
- Joined: Mon Aug 29, 2016 8:51 am
Re: 512 FPS?
There is a sleep function called in love.run to cap the fps to 512. Try using your own love.run and remove the love.timer.sleep
https://love2d.org/wiki/love.run
https://love2d.org/wiki/love.run
- zorg
- Party member
- Posts: 3468
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: 512 FPS?
Technically, it caps it to 0.001 ms, or 1000 FPS, not 512 (in the best case scenario). At least, last time i checked, that was the value in the default love.run function.KayleMaster wrote: ↑Thu Jul 19, 2018 7:44 am There is a sleep function called in love.run to cap the fps to 512. Try using your own love.run and remove the love.timer.sleep
https://love2d.org/wiki/love.run
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Re: 512 FPS?
It doesn't cap at any specific number, but it yields CPU time to the OS for 1 millisecond. It is not guaranteed to resume operation in exactly that much time, but, excluding extreme cases, it will not resume operation in less than that time. Your OS probably returns control to the process in 1.9 milliseconds, hence 512 fps.
Beat me to it, again!
Beat me to it, again!
Re: 512 FPS?
Wow, thanks for the great information.
-
- Citizen
- Posts: 65
- Joined: Wed Mar 07, 2018 11:21 pm
Re: 512 FPS?
--snip--
Last edited by MissDanish on Wed May 06, 2020 12:35 am, edited 1 time in total.
- zorg
- Party member
- Posts: 3468
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: 512 FPS?
I guess i'm just lucky my configuration happened to yield at exactly that amount of time then.
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Re: 512 FPS?
Default love.run function sleeps for 1 millisecond every frame. There is no need to sleep for 1 millisecond, you can sleep for 0 milliseconds and that will allow the OS scheduler to resume immediately, if no other threads need running, without wasting that 1 or more milliseconds. You can even forego the sleep call entirely, vertical synchronization will do the same job for you and to a much greater precision. Without the vsync however the program will run in a spinlock-like state with 100% CPU load at all times, in which case a small sleep actually prevents full CPU utilization.
Who is online
Users browsing this forum: Bing [Bot], Semrush [Bot] and 7 guests