[Qt-interest] QFont::defaultFamily() takes ridiculous share of CPU time, but only on Windows
Philipp Münzel
mailing-lists at philippmuenzel.de
Thu Apr 7 14:28:17 CEST 2011
Hi folks,
I develop an application that renders a lot of bitmaps with text on them.
This works roughly like this:
QImage image;
QPainter painter;
painter.begin(&image);
QFont mono_8("Inconsolata", 8);
QBrush brush(QColor(r,g,b), Qt::SolidPattern);
QPainterPath path;
path.addText(x, y, mono_8, text);
painter.fillPath(path, brush);
painter.end();
Each rendering consists of about 50 to 100 words.
The result is reasonably fast on Linux.
On Windows, however, performance is rather bad.
I used Intel VTune as a profiler to see what is consuming the CPU time.
I found that on Windows, 50% (!!!) of the CPU time is spent in the function
QFont::defaultFamily(). What is this?
When I profile on Linux, I see pretty much the result I expected, most of the time is consumed by the QPainterPath::addText() function.
What's the QFont::defaultFamily() function doing? Why does it take such an enormous amount of CPU time on windows, where on Linux, I don't even find it in the top 100 functions of my profiling?
How and why gets QFont::defaultFamily() called in the scenario described above?
Regards,
Philipp
More information about the Qt-interest-old
mailing list