4 ms·
Also using big O notation here makes no sense surely? The claim that the switch version is (in contrast) O(1) is not even wrong.
by derriz 10y ago
Also using big O notation here makes no sense surely? The claim that the switch version is (in contrast) O(1) is not even wrong.
- clusmore 10y agoYeah I'm not quite sure I understand this statement either. Does he mean that in the case of a command the first `if` passes and the rest are ignored, but in the case of status and error you need to perform the previous `if`s as well? So then the case for status is what, O(2)? That makes no sense. If you're going to write something this obscure for the sake of "performance", you want to be damn sure it's worth it -- that performance is even an issue, and that this is a large enough improvement to justify not doing the simple thing. Honestly it feels like the author wants to do it this way because it's clever, and the "performance" reason is just rationalising it.