Is it easy to waste performance?

Let me start with the answer to the question I posed in the title: YES.

Earlier this week I introduced a scenProc update that could handles holes in shapefile polygons. This new features used the functions I have to do boolean operations on polygons. Things like intersect or subtract two polygons. This functionality is also used in the ground polygon wizard of ModelConverterX or in the SPLITGRID step of scenProc. Initially I noticed that loading the shapefiles with holes took quite a bit longer than loaded the shapefiles before.

So time to have a look where that extra time was spend. Not really surprisingly it was inside my boolean functions. After I used a profiler to see in which functions most time was spend (it is always in the functions that you don’t expect), I was able to optimize the algorithm quite a bit more.

So compared to the beginning of the week, my boolean functions have become at least 6 times quicker. That will not only be useful when importing shapefiles with holes, but also when performing the SPLITGRID step. So I hope you enjoy the extra speed.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.