3 ms·
I think optimizing time complexity is a bad idea in c++. Let's say I write an o(n^2) sort because i know it will be faster for the small n's I have, then I don'
by notatcomputer67 8y ago
I think optimizing time complexity is a bad idea in c++. Let's say I write an o(n^2) sort because i know it will be faster for the small n's I have, then I don't want some meddling compiler "optimize" it for me.
Another reason. People will come to depend on it and then seemingly innocent changes will mysteriously degrade performance. That's btw why I'm excited about guaranteed copy elision in c++17 - I feel uncomfortable relying on the compiler probably not copying my massive objects.
Overall I could see the trade-off be worthwhile in some languages but not c++.