Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.6.0
-
None
-
Windows
Description
The function QWindowsFontEngine::getGlyphBearings in qwindowsfontengine.cpp calls GetCharABCWidthsI to get information about the font a lot. However there is no caching at all, which results in a performance bottleneck (especially when calling functions like QPainter::drawText often).
When hooking GetCharABCWidthsI to manually cache based on the HFONT pointer, the bottleneck disappears. See here for my (very crude) implementation.
Some numbers (after running my application for about 20 seconds):
HGDIOBJ: 3B0A22E9 count: 4, hits: 2, misses: 2 HGDIOBJ: A70A1E93 count: 1374, hits: 1348, misses: 26 HGDIOBJ: 000A1F1B count: 140039, hits: 139925, misses: 114 HGDIOBJ: 7C0A2302 count: 581, hits: 550, misses: 31
Hotspots before:
Hotspots after: