Speed improvements for calculating NDCG