I've been cooking a bit since I noticed that javascript testOverlap() does not benefit from collision cells. In other words it's a brute force check and can get quite expensive. See: github.com/Scirra/Construct-bugs/issues/5665
So I dug out a js implementation of quadtrees, did some minor adjustments and now it works in Construct. Here's the OG github.com/timohausmann/quadtree-js
Here's it adapted for C3.
wackytoaster.at/parachute/quadtree.c3p
How well does it work? It depends. If I test the overlap between 2000 vs 2000 instances, it actually outperforms events by quite some. Easily a 2.5-3x increase in fps. Cool, BUT... If I test overlap between 1 vs 4000 instances, events are better and outperform the quadtree thingy.
The amount of collision checks still decreases compared to events, so that must mean the overhead of rebuilding the quadtree is what ends up eating a lot of potential benefit. It seems that somewhere around 150 vs 2000 instances the quadtree starts to pull ahead of events.
There's also a fork that adds a method to update objects instead of rebuilding the quadtree. This would only need to be called for instances that move, so the benefit really only shows if there's plenty of static objects that don't need updating. With many moving objects, it performs worse than just rebuilding the quadtree.
There's also a version 2 github.com/timohausmann/quadtree-ts that I didn't touch because I don't know typescript. Perhaps this one is a bit faster?
Either way, I'm looking for some thoughts about this. It seems totally worth it to look into it further considering the performance increase in SOME cases. But it's also worth it because right now in javascript there is no way to access the collision cell optimization from Construct. :(