Recent

Author Topic: TextOut benchmark - Qt5 is about 2x slower than Gtk2  (Read 1147 times)

AlexTP

  • Hero Member
  • *****
  • Posts: 1848
    • UVviewsoft
TextOut benchmark - Qt5 is about 2x slower than Gtk2
« on: April 16, 2022, 11:14:30 am »
Pls see the benchmark demo from
https://forum.lazarus.freepascal.org/index.php?topic=55431.0

On gtk2:

- only "TextOut" is checked -> paint time is ~20ms here
- only "colored TextOut" is checked -> time is ~30ms
- both "TextOut" and "colored TextOut" checked -> time is ~120ms (non liner grow! bad!)

On Qt5:

- only "TextOut" is checked -> paint time is ~40ms here
- only "colored TextOut" is checked -> time is ~50-60ms
- both "TextOut" and "colored TextOut" checked -> time is ~100-110ms (liner grow, at least - it is good)

Qt5 timings are about 2x slower than Gtk2!
PC: CPU Intel Core i3, OS Ubuntu 20.x.

« Last Edit: April 16, 2022, 02:07:17 pm by AlexTP »

AlexTP

  • Hero Member
  • *****
  • Posts: 1848
    • UVviewsoft
Re: TextOut benchmark - Qt5 is about 2x slower than Gtk2
« Reply #1 on: April 16, 2022, 11:40:35 am »
Zeljko, can you do something here, please?
I appreciate your work on Qt5 WS.

zeljko

  • Hero Member
  • *****
  • Posts: 1264
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: TextOut benchmark - Qt5 is about 2x slower than Gtk2
« Reply #2 on: April 16, 2022, 07:32:57 pm »
So, on my machine Qt5 needs cca 58 msec, gtk2 30 msec for simple draw text (only one checkbox is checked). When I comment QtDC.drawText() from TQtWidgetSet.ExtTextOut (which is called by Canvas.TextOut) then Qt5 needs more than 30msec (but draws nothing), so need a lot of investigation about allocating font & brushes for QPainter. Tested pure Qt5 drawText() and it needs less than 30 msec.

AlexTP

  • Hero Member
  • *****
  • Posts: 1848
    • UVviewsoft
Re: TextOut benchmark - Qt5 is about 2x slower than Gtk2
« Reply #3 on: April 18, 2022, 09:30:51 am »
We have a change to speed up, good.

AlexTP

  • Hero Member
  • *****
  • Posts: 1848
    • UVviewsoft
Re: TextOut benchmark - Qt5 is about 2x slower than Gtk2
« Reply #4 on: April 30, 2022, 01:20:07 pm »
@zeljko
I think about the additional way to render the text, not C.TextOut nor C.ExtTextOut. Additional method - we name it. Like C.TextEx. This method must render some text string (one liner only, handling of EOLs and TABs must be in caller). With custom font color + custom BG color (or transparent BG, it is enough, we can fill BG ourself). Maybe - not sure here - with custom Dx offsets, but it is optional.

If it will be fast, I will use it in the text-editor.
What do you think?
« Last Edit: April 30, 2022, 01:33:29 pm by AlexTP »

zeljko

  • Hero Member
  • *****
  • Posts: 1264
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: TextOut benchmark - Qt5 is about 2x slower than Gtk2
« Reply #5 on: April 30, 2022, 03:32:18 pm »
You can write your own ws dependent textout routines.
In that case it can be much faster and optimized, eg by using paths etc.
Off topic: this is probably what you have been looking for about highdpi question:
https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/39610
There's my solution on the bottom.

AlexTP

  • Hero Member
  • *****
  • Posts: 1848
    • UVviewsoft
Re: TextOut benchmark - Qt5 is about 2x slower than Gtk2
« Reply #6 on: April 30, 2022, 07:28:06 pm »
High-DPI: thanks.

My own text rendering: impossible for me to dig into Qt5 and GTK2, so I can only test the solutions other ppl give.

AlexTP

  • Hero Member
  • *****
  • Posts: 1848
    • UVviewsoft
Re: TextOut benchmark - Qt5 is about 2x slower than Gtk2
« Reply #7 on: May 03, 2022, 10:41:03 pm »
Maybe I can adapt some ready rendering code, from some example, for Qt5. I just did not find Pascal examples for Qt5 rendering.

AlexTP

  • Hero Member
  • *****
  • Posts: 1848
    • UVviewsoft
Re: TextOut benchmark - Qt5 is about 2x slower than Gtk2
« Reply #8 on: May 18, 2022, 10:32:25 am »
Any update on optimizing Qt5 rendering?

 

TinyPortal © 2005-2018