Profiling wxSTC on Mac

Hi Robin,

I was testing Stefan's new CoreGraphics wxDC, and one thing that was missing was GetPartialTextExtents, so I found some time to 'implement' it, using ATSUI believe it or not. But, I found the text drawing is about just as slow. So, I started thinking, hmmm... Maybe I need to profile this. :wink: So I started up Sampler (/Developer/Applications/Sampler.app) and profiled the wxPython demo.

What I found was that wxDC::GetPartialTextExtents() wasn't even on the map so far as profiling was concerned. But the profiler showed that 61% of the time was being spent in ScintillaWX::FullPaint(). So I played around a bit, and I found that if you remove the "stc->Refresh(false)" call in ScintillaWX::FullPaint(), wxSTC REALLY speeds up. Even with anti-aliasing on in CoreGraphics, it's keeping up with my typing. :wink: I haven't seen any adverse affects, and I think it's really because Update on Mac does all the work Refresh does already.

As I said, this is with CG and using ATSUI, but I have a feeling even on the plain ol' QuickDraw DC you'll see a big speed up if you remove that stc->Refresh(false) call. I'll test more tomorrow, but I wanted to give you a heads up on this so that I'll know that this really works and that I'm not crazy. :slight_smile:

Thanks,

Kevin

Hi Robin,

路路路

On Feb 15, 2005, at 9:37 PM, Kevin Ollivier wrote:

Hi Robin,

I was testing Stefan's new CoreGraphics wxDC, and one thing that was missing was GetPartialTextExtents, so I found some time to 'implement' it, using ATSUI believe it or not. But, I found the text drawing is about just as slow. So, I started thinking, hmmm... Maybe I need to profile this. :wink: So I started up Sampler (/Developer/Applications/Sampler.app) and profiled the wxPython demo.

What I found was that wxDC::GetPartialTextExtents() wasn't even on the map so far as profiling was concerned. But the profiler showed that 61% of the time was being spent in ScintillaWX::FullPaint(). So I played around a bit, and I found that if you remove the "stc->Refresh(false)" call in ScintillaWX::FullPaint(), wxSTC REALLY speeds up. Even with anti-aliasing on in CoreGraphics, it's keeping up with my typing. :wink: I haven't seen any adverse affects, and I think it's really because Update on Mac does all the work Refresh does already.

As I said, this is with CG and using ATSUI, but I have a feeling even on the plain ol' QuickDraw DC you'll see a big speed up if you remove that stc->Refresh(false) call. I'll test more tomorrow, but I wanted to give you a heads up on this so that I'll know that this really works and that I'm not crazy. :slight_smile:

BTW, I did get a chance to play with this some more and the QuickDraw wxDC is also showing the speedup. :slight_smile: If you're seeing this too, do you think it'd be OK to just ifdef out the call to Refresh in ScintillaWX::FullPaint?

Thanks,

Kevin

Kevin Ollivier wrote:

Hi Robin,

Hi Robin,

I was testing Stefan's new CoreGraphics wxDC, and one thing that was missing was GetPartialTextExtents, so I found some time to 'implement' it, using ATSUI believe it or not. But, I found the text drawing is about just as slow. So, I started thinking, hmmm... Maybe I need to profile this. :wink: So I started up Sampler (/Developer/Applications/Sampler.app) and profiled the wxPython demo.

What I found was that wxDC::GetPartialTextExtents() wasn't even on the map so far as profiling was concerned. But the profiler showed that 61% of the time was being spent in ScintillaWX::FullPaint(). So I played around a bit, and I found that if you remove the "stc->Refresh(false)" call in ScintillaWX::FullPaint(), wxSTC REALLY speeds up. Even with anti-aliasing on in CoreGraphics, it's keeping up with my typing. :wink: I haven't seen any adverse affects, and I think it's really because Update on Mac does all the work Refresh does already.

As I said, this is with CG and using ATSUI, but I have a feeling even on the plain ol' QuickDraw DC you'll see a big speed up if you remove that stc->Refresh(false) call. I'll test more tomorrow, but I wanted to give you a heads up on this so that I'll know that this really works and that I'm not crazy. :slight_smile:

BTW, I did get a chance to play with this some more and the QuickDraw wxDC is also showing the speedup. :slight_smile: If you're seeing this too, do you think it'd be OK to just ifdef out the call to Refresh in ScintillaWX::FullPaint?

Sounds good. I'll try to play around with it some today.

BTW, I'm going to me mostly offline again today. Hopefully I'll be all connected again starting tomorrow.

路路路

On Feb 15, 2005, at 9:37 PM, Kevin Ollivier wrote:

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Robin Dunn wrote:

BTW, I did get a chance to play with this some more and the QuickDraw wxDC is also showing the speedup. :slight_smile: If you're seeing this too, do you think it'd be OK to just ifdef out the call to Refresh in ScintillaWX::FullPaint?

Sounds good. I'll try to play around with it some today.

Unfortunatly without that Refresh the popup AutoComplete box is not being drawn completely correctly. The borders seem to have vanished except for on the top edge. This is kinda weird since it is a child window so I wouldn't expect that the refreshing (or not) of the parent would make this kind of difference...

路路路

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Hi Robin,

路路路

On Feb 18, 2005, at 2:31 PM, Robin Dunn wrote:

Robin Dunn wrote:

BTW, I did get a chance to play with this some more and the QuickDraw wxDC is also showing the speedup. :slight_smile: If you're seeing this too, do you think it'd be OK to just ifdef out the call to Refresh in ScintillaWX::FullPaint?

Sounds good. I'll try to play around with it some today.

Unfortunatly without that Refresh the popup AutoComplete box is not being drawn completely correctly. The borders seem to have vanished except for on the top edge. This is kinda weird since it is a child window so I wouldn't expect that the refreshing (or not) of the parent would make this kind of difference...

Is there an easy way I can test this (i.e. from the wxPython demo)? Also, I'll commit the GetPartialTextExtents for the CG DC as soon as I confirm everything's building OK. Got a little swamped the past couple days which got me sidetracked.

Thanks,

Kevin

Kevin Ollivier wrote:

Hi Robin,

Robin Dunn wrote:

BTW, I did get a chance to play with this some more and the QuickDraw wxDC is also showing the speedup. :slight_smile: If you're seeing this too, do you think it'd be OK to just ifdef out the call to Refresh in ScintillaWX::FullPaint?

Sounds good. I'll try to play around with it some today.

Unfortunatly without that Refresh the popup AutoComplete box is not being drawn completely correctly. The borders seem to have vanished except for on the top edge. This is kinda weird since it is a child window so I wouldn't expect that the refreshing (or not) of the parent would make this kind of difference...

Is there an easy way I can test this (i.e. from the wxPython demo)?

Yep. Use PyShell, type "import wx", then "wx." and look at the popup. This is in a non-CoreGraphics build.

Also, I'll commit the GetPartialTextExtents for the CG DC as soon as I confirm everything's building OK.

Thanks.

路路路

On Feb 18, 2005, at 2:31 PM, Robin Dunn wrote:

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Hi Robin,

Kevin Ollivier wrote:

Hi Robin,

Robin Dunn wrote:

BTW, I did get a chance to play with this some more and the QuickDraw wxDC is also showing the speedup. :slight_smile: If you're seeing this too, do you think it'd be OK to just ifdef out the call to Refresh in ScintillaWX::FullPaint?

Sounds good. I'll try to play around with it some today.

Unfortunatly without that Refresh the popup AutoComplete box is not being drawn completely correctly. The borders seem to have vanished except for on the top edge. This is kinda weird since it is a child window so I wouldn't expect that the refreshing (or not) of the parent would make this kind of difference...

Is there an easy way I can test this (i.e. from the wxPython demo)?

Yep. Use PyShell, type "import wx", then "wx." and look at the popup. This is in a non-CoreGraphics build.

Hmm... After testing this, my guess is that the drawing and invalidation areas aren't in sync. In other words, it's doing something like drawing the entire wxListCtrl, but only invalidating the client area. I think calling Refresh just accidently fixes the wxListCtrl problem. by invalidating areas the wxListCtrl itself should be invalidating. BTW, when resizing the demo window, the wxListCtrl does draw properly.

I'll look into this further and see if I can find a fix, but IMHO, the wxListCtrl bug is the less serious of the two. The sluggish performance problem impacts all users of wxSTC and really makes it close to unusable in any real sense. The wxListCtrl problem, on the other hand, is really just a visual glitch and AFAICT the control is still perfectly usable. Unless there's something else wrong, I'd vote for going with much faster performance. :slight_smile:

Thanks,

Kevin

路路路

On Feb 18, 2005, at 6:54 PM, Robin Dunn wrote:

On Feb 18, 2005, at 2:31 PM, Robin Dunn wrote:

Also, I'll commit the GetPartialTextExtents for the CG DC as soon as I confirm everything's building OK.

Thanks.

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-dev-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-dev-help@lists.wxwidgets.org

Kevin Ollivier wrote:

I'll look into this further and see if I can find a fix, but IMHO, the wxListCtrl bug is the less serious of the two. The sluggish performance problem impacts all users of wxSTC and really makes it close to unusable in any real sense. The wxListCtrl problem, on the other hand, is really just a visual glitch and AFAICT the control is still perfectly usable. Unless there's something else wrong, I'd vote for going with much faster performance. :slight_smile:

I added code to refresh the stc when the autocomp is shown or hidden. Works great now.

路路路

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!