[postgis-devel] contains optimization

David Fuhry dfuhry at cs.kent.edu
Thu Jul 26 08:05:23 PDT 2007


Robert,

    Your proposed change is called inlining [1].  A compiler is smart 
enough to automatically inline such small functions directly into the 
code of point_in_ring.  Manual inlining can make code harder to read & 
maintain.   As Charlie suggested earlier [2], you should profile the 
code to see if this is really a bottleneck.

    For optimizations, pre-change & post-change performance numbers are 
what's needed to convince people that the change is worthwhile.

Dave Fuhry

[1] http://en.wikipedia.org/wiki/Inline_expansion
[2] 
http://postgis.refractions.net/pipermail/postgis-devel/2007-July/002692.html

Robert W. Burgholzer wrote:
> I am running this by the list first, before I try it myself to get feedback. I
> will try it on my machine then post results.  Once again, I am a green C coder,
> and thus, am just making these attempts based on googled optimization
> suggestions.
> 
> I have seen that it is advised to NOT make function calls within loops as they
> add to overhead, so I am proposing to move the function:
>  determineSide(POINT2D *seg1, POINT2D *seg2, POINT2D *point)
> into the calling function:
> point_in_ring(POINTARRAY *pts, POINT2D *point)
> 
> since it is only a one line function anyhow, and should not muddy up the code.
> 
> r.b.
> 
> 
> --
> Robert W. Burgholzer
> --
> Finding the occasional straw of truth awash in a great ocean of confusion and
> bamboozle requires intelligence, vigilance, dedication and courage.  But if we
> don't practice these tough habits of thought, we cannot hope to solve the truly
> serious problems that face us -- and we risk becoming a nation of suckers, up
> for grabs by the next charlatan who comes along.
> -- Carl Sagan, "The Fine Art of Baloney Detection," Parade, February 1, 1987
> 
> Online Workout Editor:
> http://www.swat-swimming.org/workoutlog/
> http://soulswimmer.dynalias.net/
> _______________________________________________
> postgis-devel mailing list
> postgis-devel at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-devel



More information about the postgis-devel mailing list