开发者

High amount of page faults when rendering QWidgets

I noticed a large amount of page faults in my Qt application. I reproduced it by resizing a docking widget (with a widget tree of dozens of widgets underneath) for 2 seconds and traced that operation using AQTime. I get 2000 page faults for this operation. Why is that?

Using Qt 4.5.3 on Windows XP开发者_Python百科 32 bit

UPDATE: They're soft page faults

UPDATE2: I created a ui in Qt Designer with 1 combobox with 2 items in it. If I preview this, I get 200 page faults each time I click the combobox to select one of these items.

Parents
Code Type   Routine Name    Faults  Faults with Children    Hit Count
x86 qt_memfill_template<unsigned int,unsigned int>  2416    2416    5160
  x86   qt_memfill<unsigned int>    2416    2416    5160
    x86 qt_rectfill<unsigned int>   0   2416    5160
      x86   qt_rectfill_template<unsigned int>  0   2416    63
        x86 qt_rectfill_quint32 3   2419    63
          x86   fillRect_normalized 1   2420    63
            x86 QRasterPaintEngine::fillRect    3   2423    63
              x86   QRasterPaintEngine::fillRect    1   2424    63
                x86 QPainter::fillRect  1   2427    63
                  x86   fillRegion  0   2427    15
                    x86 QWidgetPrivate::paintBackground 2   2430    12
                      x86   QWidgetPrivate::drawWidget  0   2430    12
                        x86 QWidgetBackingStore::sync   2   2596    12
                          x86   QWidgetPrivate::syncBackingStore    4   2610    12
                            x86 QETWidget::translateConfigEvent 0   2479    6
                              x86   QtWndProc   0   2495    12


Most likely, Qt allocated a new bitmap to hold the widget's appearance, and the system satisfied this request by allocating new pages to the process. Upon the first write to these pages, a soft page fault occurs, and the actual pages are mapped into the process address space. This could potentially be avoided by caching the bitmap between repaint calls; however, when resizing, the size of the bitmap needed will change, and so this optimization no longer applies; the bitmap must be reallocated (causing soft page faults) each time the dimensions change.

Is this actually having a performance impact, though?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜