Win32 performance results


Subject: Win32 performance results
From: Mike Nordell (tamlin@algonet.se)
Date: Wed Mar 07 2001 - 09:52:42 CST


Straightest path with most function+child CPU time taken while simply
scrolling a document up/down using the cursor keys.

CPU Calls Function
--- ----- ----------------
68% 1011 FV_View::warpInsPtNextPrevLine
32% 1011 FV_View::_moveInsPtNextPrevLine
30% 868 FV_View::_ensureThatInsertionPointIsOnScreen
29% 590 FV_View::cmdScroll
29% 590 AV_View::sendVerticalScrollEvent
29% 590 AP_Win32Frame::_scrollFuncY
28% 590 FV_View::setYScrollOffset
34% 1611 FV_View::_draw
25% 2168 fp_Page::draw
25% 2168 fp_Container::draw
25% 89960 fp_Line::draw
25% 94658 fp_Run::draw
25% 28669 fp_TextRun::_draw
23% 28669 fp_TextRun::_drawPart
22% 21355 GR_Win32Graphics::drawChars

The reason for the jump in # of calls for FV_View::_draw is that it's called
from three different places.

A rundown for GR_Win32Graphics::drawChars, expressed in % of CPU time for
this function, not for the whole app:

38% 21 355 GetObject
25% 1 313 221 GR_Graphics::remapGlyph
18% 21 355 delete (*)
12% 21 355 new (*)
 2% 21 355 ExtTextOutW
...
(*) note that this is the debug heap that is considerably slower.

Finally a global check. Total used CPU for the app:

8% 22 824 LineTo (Win32)
8% 21 355 GetObjectA (Win32)

And really nothing more worth mentioning. Wierd, but this is what it told
me.

Sorted on # of calls

1.04% 2 626 442 XAP_Prefs::getCurrentScheme
0.63% 2 626 442 XAP_App::getPrefs
2.05% 1 313 221 GR_Graphics::remapGlyph
0.70% 1 313 221 GR_Win32Graphics::measureUnRemappedChar
0.70% 1 313 221 GR_CharWidths::getWidth
0.49% 1 313 221 GR_Win32Font::measureUnRemappedChar

What can we learn from this? Well, for starters every experienced Win32
developer knows that LineTo is quite bad. When drawing horz/vert lines (or
filled boxes), the fastest way to do this is by calling ExtTextOut (don't
ask, you don't want to know). CreatePen is slow, but LineTo is slower. Worth
noting is that this function is "only" called 22 824 times, but it's
responsible for 8.47% CPU.

The calls to GetObject to get the LOGFONT struct should really be replaced
by putting the LOGFONT in the Win32Font and only call it once for each font.

Can we do something about all the calls to GR_Graphics::remapGlyph? It calls
XAP_Prefs::getCurrentScheme and XAP_App::getPrefs twice for each invocation.

Can we do something about the gazillion calls to remapGlyph and
measureUnRemappedChar?

/Mike



This archive was generated by hypermail 2b25 : Wed Mar 07 2001 - 09:52:13 CST