[Qt-interest] QFont::defaultFamily() takes ridiculous share of CPU time, but only on Windows

Atlant Schmidt aschmidt at dekaresearch.com
Thu Apr 7 15:33:20 CEST 2011


Philipp:

> How and why gets QFont::defaultFamily() called
> in the scenario described above?

  Perhaps your Linux machine has the "Inconsolata" font
  and your Windows machine doesn't, so Qt spends a lot
  of time deciding which fall-back font to use?

                            Atlant

-----Original Message-----
From: qt-interest-bounces+aschmidt=dekaresearch.com at qt.nokia.com [mailto:qt-interest-bounces+aschmidt=dekaresearch.com at qt.nokia.com] On Behalf Of Philipp Münzel
Sent: Thursday, April 07, 2011 08:28
To: qt-interest at qt.nokia.com
Subject: [Qt-interest] QFont::defaultFamily() takes ridiculous share of CPU time, but only on Windows

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
_______________________________________________
Qt-interest mailing list
Qt-interest at qt.nokia.com
http://lists.qt.nokia.com/mailman/listinfo/qt-interest

This e-mail and the information, including any attachments, it contains are intended to be a confidential communication only to the person or entity to whom it is addressed and may contain information that is privileged. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify the sender and destroy the original message.

Thank you.

Please consider the environment before printing this email.



More information about the Qt-interest-old mailing list