wxGCDC Graphics performance on Windows.

42 views
Skip to first unread message

Tony Kennedy

unread,
Jun 21, 2021, 6:26:14 AM6/21/21
to wx-dev
Hi all,

I've got a serious performance issue on Windows.

The app I'm working on draws to a wxScrolled<wxPanel> and is painfully slow when there are over 50 objects on screen. It's absolutely fine on the Mac, performance is great there.

I've explored using Cairo to render the sketch. This helped a lot (it was much faster), but it did not render underlined/strikethrough fonts.

One thing I noticed going through some of my older builds, there seems to be a change going from wxWidgets 3.1.2 which made the performance worse. Is there an easy way to check what changed between 3.1.2 and 3.1.4 (I use 3.1.5 now)?

I'm also assuming that the best option would be to use a different renderer. Any suggestions about what I can do?

Thanks in advance for any help/suggestions.

Tony.

PS. To help with the performance, I'm painting some things using the wxPaintDC and others using wxGCDC. That helps a bit as well, but I'd really like to get similar performance to what the Mac is giving.



Eric Jensen

unread,
Jun 21, 2021, 12:33:34 PM6/21/21
to Tony Kennedy
Hello Tony,

Monday, June 21, 2021, 10:38:34 AM, you wrote:

TK> Hi all,

TK> I've got a serious performance issue on Windows.

TK> PS. To help with the performance, I'm painting some things using the
TK> wxPaintDC and others using wxGCDC. That helps a bit as well, but I'd really
TK> like to get similar performance to what the Mac is giving.

The default wxGCDC renderer under Windows uses GDI+, which is not very
fast.

Try to use the Direct2DRenderer, check the "drawing" sample on how to
do that.

One general hint when using wxGraphicsContext/wxGCDC:
If you draw wxBitmaps, convert them to wxGraphicsBitmaps once.
Otherwise they will be converted to wxGraphicsBitmaps on each repaint,
which is very slow.

Eric





--

Tony Kennedy

unread,
Jun 21, 2021, 12:48:16 PM6/21/21
to wx-dev
I managed to double post this (thought I had deleted one, but clearly failed).

Thanks. The first thing I tried was the Direct2DRenderer, but it kept crashing on me (the reason being trying to use a font that is not on the system). Even if I force a valid font, it's still very slow.

My app only really displays some boxes with words in them, nothing complex. 

All the best,

Tony.


Eric Jensen

unread,
Jun 21, 2021, 1:23:30 PM6/21/21
to Tony Kennedy
Hello Tony,

Monday, June 21, 2021, 6:48:15 PM, you wrote:

TK> I managed to double post this (thought I had deleted one, but clearly
TK> failed).
yes, sorry. I responded to your first post before i saw that Vadim hat
already responded.

TK> Thanks. The first thing I tried was the Direct2DRenderer, but it kept
TK> crashing on me (the reason being trying to use a font that is not on the
TK> system). Even if I force a valid font, it's still very slow.
this sounds familiar, but i thought that was fixed.

TK> My app only really displays some boxes with words in them, nothing complex.
Very strange. Could you show some code? Do you use GetTextExtend? I
think there were some changes regarding this between 3.1.2 and now and
this could potentially be a bottleneck. But even then, with only 50
boxes it shouldn't be noticeable on modern hardware.

Eric
--

rohit agarwal

unread,
Jun 22, 2021, 12:28:06 AM6/22/21
to wx-...@googlegroups.com
It’s possible that your graphic performance issues
are partly related to the difference in graphics performance
between your mac and windows hardware.
Mac’s, generally being more expensive, have better graphics hardware,
unless you’ve already equalised for that.

You could run a hardware performance benchmark like Geekbench to check.
--
You received this message because you are subscribed to the Google Groups "wx-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wx-dev+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/wx-dev/462950669.20210621183319%40j-dev.de.

Tony Kennedy

unread,
Jun 22, 2021, 6:07:46 AM6/22/21
to wx-dev
Yes, I do use GetTextExtent.

Once I'm past my current deadline, I'll see if I can generate a test project for this.

Tony Kennedy

unread,
Jun 22, 2021, 6:11:36 AM6/22/21
to wx-dev
I'm developing on an Asus gaming laptop (NVIDIA GeForce GTX 1070). Also testing on two Macs (M1 processor air and an eight year old Mac Pro). The performance on both Macs is fine. I've also got a small group of beta testers, all report the Windows performance problems.

I'll experiment more once my current deadline has passed.

All the best,

Tony.
Reply all
Reply to author
Forward
0 new messages