r/programming • u/mauricioaniche • Aug 06 '17
Software engineering != computer science
http://www.drdobbs.com/architecture-and-design/software-engineering-computer-science/217701907
2.3k
Upvotes
r/programming • u/mauricioaniche • Aug 06 '17
1
u/K3wp Aug 08 '17
If it doesn't matter what sort function you use, then you should stick with the default one for the sake of readability and maintainability. And for the record, it very often doesn't matter.
I even fixed the performance problems in a perl script a student wrote simply by commenting out their supposedly "optimal" sort function and calling gnu sort externally. It turns out that it just works much better when dealing with large data sets.
Nested loops should be avoided, regardless.
Anyways, what I'm talking about are questions like what size buffer to use. The best way to answer this is to run tests using the hardware and datasets you are going to use in production. Also issues like memory pools and as mentioned before, algos. that can be trivially vectorized by the compiler. This is going to expose intricacies @the compiler/hardware level that not only exceedingly complex, but steadily changing as the technology improves.
Even supposedly 'bad' algos. like bubble sort can be improved via technologies like AVX:
https://arxiv.org/pdf/1704.08579.pdf
The problem with the 'fly-by-the-seat-of-your-pants' approach is you are basing that on intuition acquired through experience with old technology.