minor perf tweaks to the knn