Hacker News new | ask | show | jobs
by csjh 877 days ago
What is the point of `algorithms::bubbleSort`?
2 comments

Last I checked bubble sort was the fastest sort for small counts of small objects. That was 10 years ago though so thing might have changed potentially something that might take better advantage of vector ops.

It's also often the correct choice for something like a collision partition for a physics sim where elements are most likely in the same sort position each frame.

Around half as much code is generated for bubble sort compared to std::sort, e.g.:

https://godbolt.org/z/KbaTeno3j