Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-59549

No caching in QWindowsFontEngine::getGlyphBearings

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P3: Somewhat important
    • Resolution: Unresolved
    • Affects Version/s: 5.6.0
    • Fix Version/s: None
    • Component/s: GUI: Font handling
    • Labels:
      None
    • Environment:

      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:

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            • Assignee:
              esabraha Eskil Abrahamsen Blomfeldt
              Reporter:
              mrexodia Duncan Ogilvie
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:

                Gerrit Reviews

                There are no open Gerrit changes