[ENH] faster rounded corners

Andreas Raab Andreas.Raab at gmx.de
Fri May 3 20:46:48 UTC 2002


Jim and all,

After I outlined the way how to eliminate the overdraw I couldn't
withstand finding a good benchmark. Finally, I came across one which
simply opens a bunch of browsers and measures the time to activate them
all around. It's a typical one since that's what you do all along when
you switch between different tools. And guess what... the benchmark (see
prefix of the CS) showed that with square corners activating system
windows is more than two times faster than with rounded corners.
Implementing the overdraw-eliminating strategy alone brings this down to
roughly 40% overhead. So much for accurately determining dirty regions.

Adding a tweak here and there including making the visibility tests in
Canvas _accurate_, removing various sends of #isKindOf: from a couple of
methods in Rectangle, and finally adding a single specific optimization
for rounded corners to BorderedMorph>>areasRemainingToFill: brings this
down to 15%.

Not bad, eh?! I'm sure there are more speedups hidden (there alway are
;-) For example, I didn't bother to check for visibility of individual
rounded corners in CornerRounder since most of these seem to be removed
already by the - now accurate - visibility tests in Canvas. Also, I
didn't do anything about handling damage groups although the hooks are
in place now. I'm pretty certain that you can get the overhead into the
5% range but I don't really care at this point ;-)

Here are some numbers from the activation benchmark:
Square Corners:  3585ms
Rounded Corners: 7531ms (before tweaks), ratio  2.10
Rounded Corners: 4095ms (after tweaks),  ratio  1.14

Cheers,
  - Andreas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DrawingTweaks-ar.9.cs
Type: application/octet-stream
Size: 12592 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20020503/0ee1f7a0/DrawingTweaks-ar.9.obj


More information about the Squeak-dev mailing list