win32lib feature request
- Posted by SDPringle Jul 31, 2008
- 803 views
The High Level Windows 32 Lib work better when you pass large sequences of things in order to do things in one function call into to it:
if 0 then -- multi function calls for t = 3.0 to 28.0-1/60 by steptm*1/60 do drawLines( widget, { angle_to_point_from_size( widget_size, time_to_angle(t) ) & angle_to_point_from_size( widget_size, time_to_angle(t+1/60) ) } ) end for -- 0.17s 0.16s on PIV-2.8GHz... else wedge = { } for t = 28.0 to 3.0 by -steptm*1/60 do wedge = append( wedge, angle_to_point_from_size( widget_size, time_to_angle(t) ) ) end for setPenPos( widget, wedge[1][1], wedge[1][2] ) drawLines( widget, wedge ) -- 0.00s 0.01s 0.02s on PIV-2.8GHz end if
The first branch that has been commented out with if 0 then ... else is the old code. Here drawLines() is called 1500 times and it takes 0.16s. The part after that to the end if is an optimized version of the old code. I put all of the data into one sequence and make two function calls.
I have something with polygons that I would like to do in one call:
I would like to do a similiar optimization with a loop that calls DrawPolygon, yet the function only can take one polygon. I propose someone write a DrawPolygons routine.
Shawn Pringle