Speed up low-level C++ entropy computation

DO NOT MERGE - For review only
Merge the downstream https://github.com/priorknowledge/loom/pull/78