build a static rank sort only when there's a chance we'll be ranking, otherwise build a more memory-efficient static sort