Revery: Performance: Show FPS counter

Created on 25 Apr 2019  路  3Comments  路  Source: revery-ui/revery

We should make it easy to add an FPS counter / track FPS - on both the native and JSOO side.

Related to #230 , in the sense of having a performance metric be front-and-center (FPS counter gives a view of overall performance, while a tracking square can help identify stutter/jitter).

Thanks @sgrove for the suggestion!

A couple of things we'll have to consider:

  • What's the right place for this? Should the rendering pipeline track FPS, and expose a boolean option, or should we implement an <FPSCounter /> in user-space?
  • In the case where there is no animations active / no active re-renders - should we just show FPS: -? Alternatively, we could show a metric like 'lastRenderTime' which is the time in ms spent to render the last frame.
A-infrastructure enhancement help wanted performance

All 3 comments

I decided to work on this and my progress is on my add-fps-counter branch.

Keeping track of fps is simple, I just needed to add a counter to the window type in Core/Window that stores the tick (from SDL's getTick) after each render cycle, and the time it took to render the last frame, using that.

Then I gave the Window module two new functions: getFPS, which returns the FPS as a float, and getLastRenderTime, which returns the last render time in milliseconds as an int.

I'm gonna see about adding an <FPSCounter /> and then make a PR with my changes.

Since my PR was merged this issue can be closed. Sorry I forgot in to write "resolves #..." in the message.

Thanks for the PR @Grinshpon!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bryphe picture bryphe  路  3Comments

bryphe picture bryphe  路  5Comments

albertorestifo picture albertorestifo  路  3Comments

broerjuang picture broerjuang  路  4Comments

JulesGuesnon picture JulesGuesnon  路  5Comments