Significantly performance improvement

A work in progress.

* for bulk loading, use partial unordered sort with quickselect instead of full native sort
* convert simple methods to context-less functions