×
Login Register an account
Top Submissions Explore Upgoat Search Random Subverse Random Post Colorize! Site Rules Donate
6

Today for the first time in all my professional programming I actually worked on a computer science algorithms problem where I took a super imperformant O(n*n) to a O(n*logn) saving 2000ms to 15ms per frame rendered

submitted by CoronaHoax to programming 4 weeksApr 1, 2025 18:35:51 ago (+6/-0)     (programming)

Crazy how rare you’re actually ever doing computer science when programming. And it’s always coveted and stolen by the ones who can’t do it lol


7 comments block

Well done!

So as not to dox oneself with context, an unrelated example of how a large CPU saving happens is traversing a 3D point cloud as pairs and selecting nearby points. With a flat list it's O(n²) to check each against each other, but an initial pass to build an octree index makes nearby spatial lookup logarithmic (region size doubling/halving), giving O(n log n).

It's even better if there's a distance limit, that drops it to O(n) with a scale factor of the general cloud density.