I'm developing an web page / application that needs to show *thousands* of polygons on a map display. When user zooms in/out or pans the map, I need to show new polygons.
Right now I am calling destroy() for old polygons after creating and adding the new ones, but problem is that destroy() seems to be rather expensive way to remove the polygons. Right now I go through the polygons in an array and call the destroy() method on all of them. For thousands of polygons this takes even tens of seconds (far, far too much) on Ubuntu Linux, Chrome 23.0 running on a core i5-2400 3.1ghz cpu with 3GB of memory, and it wasn't really satisfactory on a recent iMac either.
EDIT: the real deal-breaker is the fact that this makes the browser window unresponsive.
Is there an alternative solution for hiding the polygon from view?