The brushing in this scatterplot is optimized to use a quadtree, reducing the amount of searching needed to find the data points selected by the brush. Click "Reveal the quadtree" to see a slowed down animation of how the quadtree is traversed during brushing.
https://d3js.org/d3.v4.min.js