3 ms·
It's actually a big issue in any performance critical regions of code. I've come across this in both the network stack and the file system (user space and kerne
by mrmuagi 8y ago
It's actually a big issue in any performance critical regions of code. I've come across this in both the network stack and the file system (user space and kernel).
Switches can sometimes be optimised away into O(1) using clever static compile time tricks, but if you rely on jump indirection you get branch misdirection penalties, or even worse for a ladder of if's, you are doing O(N) work (where N is number of cases).
- Scooty 8y agoSeems like the key is "performance critical regions of code". Yeah optimize code that is performance critical. Don't optimize the other 99%.
- mrmuagi 8y agoI agree with you, yeah. The problem is sometimes you have to go back to old code and optimise it, because today's performance expectations are higher than yesterdays -- whether because hardware has become more powerful or software is being pushed to its limits. So I'm a bit biased, thinking, "If only this was optimised day 1", but truthfully, recognising the requirements and reacting to the performance needs as they arise can be less wasteful than having ironclad performance requirements that won't be met or needed to be met.