[Mapserver-dev] Speed Increase #2 of the day
steve.lime at dnr.state.mn.us
Tue Nov 25 12:48:57 EST 2003
This one is in the 4.1 CVS. Alan, can you confirm it's faster?
>>> Alan Steremberg <alans at wunderground.com> 11/6/2003 1:55:22 PM >>>
The label cache does some kind of polygon checking to see if labels
intersect before drawing them.
I profiled the code using one of my hairy map examples where I was
130,000 street lines, and a bunch of city labels, etc. In my case, I
found that 99% of the time the two polygon's weren't intersecting. This
the worst case scenario for the code:
I was able to greatly increase my performance by adding this check to
top of the code:
/* AJS - alans at wunderground.com */
/* STEP 0: check bounding boxes */
if (!msRectOverlap(&p1->bounds, &p2->bounds))
It checks the quick to calculate case of are the bounding boxes
overlapping, if not, let's get out of here quickly. I was thinking
investigating fancy polygon overlap strategies (scanning, etc??) but
made my crazy map with 200,000 items on it draw really quickly, so I
figured I was done for now.
This took my example from 0.21 sec to 0.09 sec. seems good.
I will keep profiling.. I replaced the truetype font code with bitmap
that rotates, seems to be a lot faster if you want a lot of labels on
map. The code still needs some work, but I would be happy to
it once it is done. In the process we found that at certain angles GD
doesn't return the correct bounding boxes.. That is why text sometimes
bumps into each other.
415-543-5021 x 103
Mapserver-dev mailing list
Mapserver-dev at lists.gis.umn.edu
More information about the mapserver-dev