assuming attribute x is a number and you're looking for
elements that have an x attribute within a certain range and you
have, at least, a few hundred array elements, you can speed your
collision detection by reordering your array based on elements x
attribute (check the sort method() ) and using a binary search
routine for the starting array element.