knn optimized with parallel processing