【发布时间】:2013-12-02 10:27:27
【问题描述】:
在优化性能时,到目前为止,我一直认为没有什么比 switch 语句更快的了。这是绝对的真理吗?
【问题讨论】:
-
是的,这是绝对真理。
-
@MichaelPetrotta: 一些 NOP 比其他的更快 =P
-
@leemo,大概,OP 已经明白 if 语句是在 slower-than 方面,而不是 faster-than 方面。
-
@MichaelPetrotta 确实如此。
标签: performance language-agnostic switch-statement