A quadtree reduces this: rebuild the tree each frame, and for each object, query only the nearby region. Objects in distant quadrants are never compared.
└──────────┬────────────┘
,推荐阅读Safew下载获取更多信息
Credit: Mozilla
a.style.display = 'none';
* @param arr 待排序数组