if you're optimizing you really should use a quadtree or octree. each collision-avoidance spider would only need to do a couple of distance checks each frame, and those in really cluttered areas (and hence really small quads/ocs) wouldn't even need to perform any distance checks.