Basic optimization

Now points are sorted before they’re counted, leading to significant
optimizations. It still needs a lot of work on that front, though, and
eventually some way to drop sorting altogether.