Details
-
Bug
-
Resolution: Duplicate
-
Not Evaluated
-
None
-
5.11.1
-
None
Description
On trying different perf optimizations (Loader, removing some nodes in QML tree), noticed that there's always a flat 200-300 ms spent before rendering any QML (profile with QtCreator QML Profiler)
Profiled again using Windows Tools XPerf and noticed that upon creating the first element in a window that's based on QQuickText a lot of time is spent on the UI thread in QWindowsFontDatabase loading the fallback font families (see attached screenshot of stack and weights)
Narrowed it down to the fact that qt_getCanonicalFontNames has to GetDC/ GetFontData/ReleaseDC for each font, which summed up over multiple fonts make for a very expensive set of calls. Especially GetFontData, which opens the TTF font tables.
I don't know why the familyName information in the EnumFontFamiliesExProc params isn't enough and why each font's name has to be re-queried using GetFontData. At the very least, calling GetDC / ReleaseDC every time could be avoided.
There should also be
- Some env var by which I can opt out of loading fallback families
- Some way to pre-load the QWindowsFontDatabase at application start-up so it doesn't freeze the UI thread when the user tries to open a new window
- This does not respect the async QML Loader behavior - it runs on the UI thread regardless of that flag, so using a Loader doesn't workaround the behavior
Attachments
Issue Links
- duplicates
-
QTBUG-59360 qt_getCanonicalFontNames takes a huge amount of time
- Closed