You can use Sweep and Prune that is commonly used in Physics.
SAP tests can be done with 3 "if" checks.
Updating the the structure is O(1) too.
I'm managing a 100k cubes demo in WebGL with 44fps. Without SAP it runs at 7fps only.
Jump to content