[WIP] Profiling GPU & CPU
See original GitHub issueMajor Goals
- What is causing the code to do more GPU calls and which GPU calls cause Frame Rate to drop.
- What is the most extensive job on GPU.
- Which parts of the code need to be optimized.
- Profiling on average cards like RX580, GTX 1050, GTX 1060 & etc.
- Profiling on different browsers.
Description of Issue:
Before I dive deep into the explanation of what is happening I would strongly recommend that one should go through the attached files.
The issue is primarily based on the tests performed using the CPU/GPU traces along with the Performance logger.
High CPU Usage
Currently, if we look at the screenshot attached below we can see clearly that there is a high CPU usage by the application during rendering and during the usage, the CPU usage increases drastically.
Performance Degradation in Update Avatar
On further diving deep into the function calls of what caused this high cpu usage during the rendering is caused by the UpdateAvatar
function that actually calls interpolants
which takes most of the CPU. This actually triggers the browsers to drop the frames which don’t make on time.
Preview Canvas
Furthermore, the issue doesn’t stop here there is a high render usage call which is made to the preview canvas on every frame, and on average end GPU machine/Mac’s this causes a massive drop in FPS. Turning off the preview canvas actually makes the application’s FPS to be increases by almost 10 FPS. Although the preview canvas is not required to re-render on each frame instead it’s required to be rendered on avatar update only.
Late Update of Avatar
The issue with the avatar’s system late update function triggers the on VRM Spring Bone which triggers the multiplyMatricess
call. One call takes approx 387 MS to calculate the result that causes the entire frame to wait for its completion.
Browsers
- Opera GX is giving access to more resources than Chrome
- Chrome is limiting FPS.
Card Compatibility
Scene | Card | FPS | Crash If Any | |
---|---|---|---|---|
Street | Rx580 | 30-60 | if AMD Free Sync is on application crashes | |
Street | GTX 1050 | 10-15 | - | |
Street | GTX 1060 | 10-15 | - | |
Street | Macbook Pro 2019 AMD 4GB | 5-6 | - | |
Street | Macbook M1 | 15-20 | - |
Issue Attachments
Performance Profile of Grid Scene Trace Profile of Grid Scene
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (6 by maintainers)
Top GitHub Comments
One interesting fact that I found it that there is a Gaming browser Opera GX that doesn’t cap the resources which are being capped mostly in chrome and lets you use your GPU to its full.
I am currently working on Avatars & Animations and checking GPU/Heap by switching on/off certain aspects.
Opera GX might be a good thing to base our Electron-style package on. I know Chrome has a bunch of anti-gaming heuristics we are fighting.