Implement entropy ranking in C for 40x speedup