QWebEngineView CPU and GPU usages are extremely high
-
wrote on 4 Dec 2021, 04:46 last edited by fatiao101 12 Apr 2021, 05:03
I got an animated web page developed with Cocos2d from my workmate.
Demo LinkI use the Qt demo project “simplebrowser” to test the web page. When the page is loaded and stable,
CPU and GPU usages are extremely high.
But if I open the page in Chrome, the performance is normal.I tested three versions of Qt(I only need 32bit):
- Qt 5.7.1 msvc 2013 32bit
- Qt 5.8.0 msvc 2015 32bit
- Qt 5.12.3 msvc 2017 32bit
They all showed the same performance(High CPU and GPU).
Hardware:
- CPU: Intel Core i5-4590 3.3GHz
- Graphics Card:NVIDIA GeForce GT 710
- Memory: 8G
Screenshots:
-
simplebrowser.exe(32bit):
Use:
QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
QCoreApplication::setAttribute(Qt::AA_UseOpenGLES);
So,
How can I reduce the CPU and GPU usages? Are there some configurations I can set? -
I got an animated web page developed with Cocos2d from my workmate.
Demo LinkI use the Qt demo project “simplebrowser” to test the web page. When the page is loaded and stable,
CPU and GPU usages are extremely high.
But if I open the page in Chrome, the performance is normal.I tested three versions of Qt(I only need 32bit):
- Qt 5.7.1 msvc 2013 32bit
- Qt 5.8.0 msvc 2015 32bit
- Qt 5.12.3 msvc 2017 32bit
They all showed the same performance(High CPU and GPU).
Hardware:
- CPU: Intel Core i5-4590 3.3GHz
- Graphics Card:NVIDIA GeForce GT 710
- Memory: 8G
Screenshots:
-
Chrome 96.0.4664.45 (64 bit):
-
simplebrowser.exe(32bit):
-
simplebrowser.exe(32bit):
Use:
QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
QCoreApplication::setAttribute(Qt::AA_UseOpenGLES);
So,
How can I reduce the CPU and GPU usages? Are there some configurations I can set?@fatiao101
some env varibales which come to mind you can try:
QTWEBENGINE_DISABLE_GPU_THREAD=1
QTWEBENGINE_CHROMIUM_FLAGS="--disable-viz-display-compositor"
only when using QML:
QSG_RENDER_LOOP=basicare you testing release builds?!
-
@fatiao101
some env varibales which come to mind you can try:
QTWEBENGINE_DISABLE_GPU_THREAD=1
QTWEBENGINE_CHROMIUM_FLAGS="--disable-viz-display-compositor"
only when using QML:
QSG_RENDER_LOOP=basicare you testing release builds?!
wrote on 6 Dec 2021, 08:56 last edited by@raven-worx Thank you for reply. Release version has the same performance. The configurations you recommended are not working.
-
@raven-worx Thank you for reply. Release version has the same performance. The configurations you recommended are not working.
@fatiao101
you can try very sleepy (with your debug build) and check in which methods the CPU spends the most time -
@fatiao101
you can try very sleepy (with your debug build) and check in which methods the CPU spends the most timewrote on 3 Mar 2022, 02:46 last edited by@raven-worx
After testing, for my case, it is mainly caused by the frame rate of the cocos2d-js web page. The default frame rate is 60. I changed it to 30 for either canvas or webgl render mode. The usages of CPU and GPU dropped significantly.