Use indexes instead of sub binaries when compressing

This reduces the time from 18.5 to 12.5 which is fairly significant.

A small tweak also makes it compress slightly better, the sliding
window was ignoring a byte in some cases where it shouldn't have.