Stefan Schimanski wrote:
Some profiling on Mac with Qt 4.2.x tells me:

* 18% QPainter::drawTextItem
* 18% QTextEngine::shape
* 70% paintPar (includes the upper two)
* 11% updateMetrics

So 70% of the whole painting process goes into paintPar. Am I wrong that this part would go down more or less linearly in the number of paragraphs we draw?

It should be possible to cache the Paragraph painting. That is, instead of the word level caching. The key would then be the paragraph id. Sounds promising...

Only 36% seem to be spent in Qt though.

I suspect there is more than that that does not immediately show in your profile.


Those numbers come from sliding around the User Manual with the scrollbar. Probably all that needs a deeper analysis, e.g. maybe the numbers for other items go up without drawing (by caching effects...).

Instead of doing partial redraw, I would use a QPixmapCache to cache word painting. The main problem in Mac is that Qt is damned slow at font metrics calculation. And Qt needs to recalculate the font metrics for each text painting. But caching small transparent pixmaps of painted words inside QLPainter we can speedup painting tremendously. I've played a bit with this approach some months ago and it is certainly doable.

Interesting approach. One should implement a prototype and see what happens.

I had a prototype once. It was quite easy to implement. Once I find some time I'll try to redo it again.

Abdel.

Reply via email to