Mike Chambers recently hosted a contest to write a faster version of my AS3 ProximityManager class (which was a lazy port of my AS2 version). Many of the results were blazing fast, but not really suited to or optimized for real-world use (including my entry, that took 2nd place).

I thought it would be good to release a more optimized version of my library that was designed for real use. This version is significantly slower in Mike's benchmarks (about 2-3X slower), but that's because it is tuned for real use cases, concerns itself more with memory use, and includes features like list management, non-zero origins, and variable radii.

It provides a good lesson - optimization is great, but it's necessity in context always has to be weighed against API, feature, and readability concerns.

Here's quick demo of it in action, showing 5000 items being updated and compared to the 4 bases every frame:

You can grab the code, docs, and demo here.

Feel free to provide any ideas on speeding it up further in the comments.