Hi,

Doing the Marlin integration and running my MapBench test suite, I figured
out a performance issue with Path2D.needRoom ():
EXPAND_MAX= 500 is a performance bottleneck for huge paths !

FYI I created a spiral test with 800k line segments:
- Marlin renders it in 2s.
- If I call createStrokedShape, it takes 56s !!

I suspect the GeneralPath is growing from 4000 (initial Path2d capacity) to
800 000 step by step (grow= 500) that implies a very big overhead: 1 array
allocation (zero-filled and previous arrays to be GC'ed) and 1 array copy
for each resize ...

I propose to modify the grow parameter = max (500, size / 8 or 16) as I
already did in gvsig's GeneralPathX class.

I know it will waste more memory for large paths (>5000) but:
- you can use the copy constructor that also trims arrays
- I can add a trim () method like the Vector class if you agree.

Anyway, it will have no impact on small or medium paths (size < 5000).

Do you know what were the objectives behind the expand limit ?

Regards,
Laurent

Reply via email to