From d607d3722d21bdd296fae40a88d72d6a6228fe60 Mon Sep 17 00:00:00 2001 From: Erik Cowley Date: Fri, 20 Oct 2023 21:51:09 -0400 Subject: [PATCH] Use partial sort since we don't need a full sort --- ghostland.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ghostland.cpp b/ghostland.cpp index 5ef80f4..0a0aee8 100644 --- a/ghostland.cpp +++ b/ghostland.cpp @@ -480,7 +480,7 @@ int main(int argc, char *argv[]) { return a_dist2 < b_dist2; } } ghost_compare; - std::sort(ghosts.begin(), ghosts.end(), ghost_compare); + std::partial_sort(ghosts.begin(), ghosts.begin() + ghosts.size() / 5, ghosts.end(), ghost_compare); for (int i = ghosts.size()/5; i >= 0; i--) { glm::mat4 ghost_model = ghosts[i]->get_model(camera_pos); ghosts[i]->apply_movement(current_frame, timed);