Title: [commits] (alecf) [7645] more performance improvements -
stop
using wx.Image_RGBValue and just use the color tuple directly
John Anderson wrote:
Hi Alec:
I briefly looked into the cost of wx.Image_RGBValue and it looks like
the overhead is the same as creating any wx object, which we're using
all over the place. On first glance it seems like the only place this
would matter is if you are calling it a lot, e.g. on every pixel of a
bitmap. Did you measure any benefit in any other situation?
I didn't...this particular change dropped the rgb/hsv conversion right
out of the top 10 methods being called from MakeGradientBitmap which is
used constantly in the calendar (and called for every pixel in the
gradient, as you mention)
The only other place we use this particular thing is in the sidebar to
get the hue to rotate the color. I switched over to the colorsys thing
in my local tree, but didn't notice much of a difference.
That said, I'm finding that creating objects that I formerly thought
were fairly cheap, like wx.Rect, wx.Point, and so forth, are coming up
somewhat visibly in the profile analysis. I sometimes use them as
convenient ways of representing an x,y position, or a region on the
screen, even if the rect doesn't always get passed to wx.
They're not horrible though, and I don't fore see an immediate need to
rewrite wx.Rect in Python right now, but they're not insignificant
either. Just something to think about for the future..
Alec
John
[email protected]
wrote:
- Revision
- 7645
- Author
- alecf
- Date
- 2005-10-05 11:08:22 -0700 (Wed, 05 Oct 2005)
Log Message
more performance improvements - stop using
wx.Image_RGBValue and just use the color tuple directly
Modified Paths
Diff
Modified:
trunk/chandler/parcels/osaf/framework/blocks/DrawingUtilities.py (7644
=> 7645)
--- trunk/chandler/parcels/osaf/framework/blocks/DrawingUtilities.py 2005-10-05 17:51:59 UTC (rev 7644)
+++ trunk/chandler/parcels/osaf/framework/blocks/DrawingUtilities.py 2005-10-05 18:08:22 UTC (rev 7645)
@@ -200,8 +200,7 @@
# now calculate the actual color from the gradient index
sat = satStart + satStep * gradientIndex
color = rgb2color(*hsv_to_rgb(hue, sat, value))
- rgb = wx.Image_RGBValue(*color)
- image.SetRGB(x,0, rgb.red, rgb.green, rgb.blue)
+ image.SetRGB(x,0, *color)
# and now we have to go from Image -> Bitmap. Yuck.
brush = wx.Brush(wx.WHITE, wx.STIPPLE)
_______________________________________________
Commits mailing list
[email protected]
http://lists.osafoundation.org/mailman/listinfo/commits
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Open Source Applications Foundation "Dev" mailing list
http://lists.osafoundation.org/mailman/listinfo/dev