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

No caching in QWindowsFontEngine::getGlyphBearings

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.6.0
    • GUI: Font handling
    • 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:

      Attachments

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

        Activity

          People

            esabraha Eskil Abrahamsen Blomfeldt
            mrexodia Duncan Ogilvie
            Votes:
            1 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes