improvement in Font::drawText: fix or only workaround?

Simon Hausmann hausmann at kde.org
Sat Mar 5 10:59:16 CET 2005


On Saturday 05 March 2005 10:40, Stefan Heimers wrote:
> Am Samstag, 5. März 2005 09.58 schrieb Simon Hausmann:
> > That's not a problem. QConstString doesn't create a copy of the data,
> > it's cheap to construct and destruct.
>
> Hi,
>
> It's still creating a new object, which is not negible even if it's not
> that bad.

It's completely negligible compared to the time QPainter::drawText takes, 
which is a pretty complex function.

> Don't do a qstr.length(), that's another unnecessary function call.

Actually that doesn't result in a function call as the compiler inlines that 
trivial line of code (access to d->len).

I'd rather go back to the old code and ensure that the call to simpleText() 
becomes a trivial operation by calling it once explicitly in some good place 
Leo probably knows best :)

Simon


More information about the Kde-optimize mailing list