The performance of the switch has been improved by 3 times, I only used this trick!

Previous article "If Fast or Switch Fast? "Decrypting the Secret Behind Switch" We tested the performance of if and switch, and came to the conclusion that we should use switch as much as possible, because its efficiency is much higher than if. For specific reasons, click the link above to view.

Since the switch is so attractive, is there a better way to make the switch faster ?

The answer is yes, otherwise this article will not be born, is it?

image

In the last article comparing if and switch performance, some readers asked: Is the switch performance of the String type also higher than that of if? Let me talk about the answer first, the performance of the String type conditional judgment switch is still better than if .

Say no proof, first give an example

Guess you like

Origin blog.51cto.com/15075516/2606432