Skip to content

Conversation

@almarklein
Copy link
Member

Timings

All numbers are in FPS, on a full-screen window on a Retina display (physical size 5120x2774).
The Cocoa is a WIP native backend for MacOS that uses Metal to display a texture that's stored in RAM.
The Null backend has _rc_present_bitmap as a no-op, so the bitmap is downloaded to CPU and then discarted.

Cube example

  • Screen:
    - Glfw: 180-200
    - Qt: 120-190
  • Sync bitmap:
    - Qt: ~51
    - Cocoa: 65-70
    - Null: 70-80
  • Async bitmap:
    - Qt: ~70
    - Cocoa: 110
    - Null: 140

Heavy example

  • Screen:
    - Glfw: 48-51
    - Qt: 48-51
  • Sync bitmap:
    - Qt: 21-23
    - Cocoa: 25-27
    - Null: 27-30
  • Async bitmap:
    - Qt: 46-51
    - Cocoa: 46-51
    - Null: 46-51

Interpretation

  • By doing the presentation asynchronous, the performance can be significantly increased.
  • For light visualizations, where presenting to screen yields 100+ FPS
    • For a delay of 1 frame, the result is faster, but not as fast as screen.
    • TODO: what if we have larger delays?
  • For light visualizations, where presenting to screen yields about 50-60 FPS
    • The sync bitmap present is about twice as slow.
    • The async present with 1 delay is nearly as fast as screen.

Todo

  • Allow turning off async.
  • Ring buffer for larger delays.
  • Also enable presenting downloaded buffer in between two frames, to minimize the delay at lower framerates.
  • Allow the canvas to consume the mapped array, avoiding one data copy.

@hmaarrfk
Copy link
Contributor

wow!

@hmaarrfk
Copy link
Contributor

I would love to help benchmark on some unique systems configurations i have:

i was having a hard time getting pyside6 to show fps numbers above 60 fps on my (linux) machine.

I feel like I must set:

  1. An environment variale to select which GPU
  2. Is there an environment variable to select the "null" backend??
  3. Would it print the FPS on the terminal for me?

Happy to setup a development environment for this, i can readily test on:

  1. Linux + Intel integrated GPU
  2. Linux + Nvidia dedicated GPU
  3. Linux + AMD integrated GPU
  4. Linux Laptop + Intel Integrated GPU.

@almarklein
Copy link
Member Author

almarklein commented Nov 12, 2025

Create a canvas like this (e.g. taking our cube.py example):

canvas = RenderCanvas(
    title= $backend - $fps fps",
    update_mode="fastest",
    vsync=False,
    present_method='bitmap'  # bitmap or screen
)

Then the fps is shown in the title bar.

There is no actual null backend. I just temporarily made _rc_present_bitmap (the method that consumes the bitmap) return immediately. You can do this with any backend I guess. The idea is that it measures how fast bitmap rendering could be if the consumption of the bitmap were infinitely fast :)

My first benchmarks were on my Mac M1. I will add some tests with Intel and NVidia GPU's later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants