Re:“Clean” Code, Horrible Performance
by mattgreenrocks on Tuesday February 28, 2023 @07:37PM
(#34977136)
It’s less about accidentally writing n^2 sorts and more about not accidentally creating n^2 algorithms.
Not sorting, but very simple algorithms that can't afford having O(n^2) performance? That's common even in CRUD apps.
Perhaps not sort so much, but certainly with search I've seen people roll their own inefficient search functions many times.
Re:“Clean” Code, Horrible Performance
by joaonmatos on Sunday March 05, 2023 @05:11AM
(#35028300)
It is the exact same situation, though. Most people can just chain a sort and a binary search to do it, and both are included in most languages.
Or just put it into a tree map, if your language has it.
Even languages that are notorious for having tiny libraries, like C and JS, have built-in sorts.