Use sorted-list caching to improve large-file performance

Fixes #29