You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In http://golang.org/cl/32122, I optimized a switch-based implementation to be a boolean expression. The two implementations below are semantically equivalent:
benchmark old ns/op new ns/op delta
BenchmarkA-4 16.3 11.9 -26.99%
We could consider having the compiler recognize the pattern of switch (with boolean expression as cases) and all return values are either boolean literals or expressions and have the compiler automatically optimize that into a single larger boolean expression.
Using 587b803
In http://golang.org/cl/32122, I optimized a switch-based implementation to be a boolean expression. The two implementations below are semantically equivalent:
Testable benchmark: https://play.golang.org/p/KMlv43EVQn
The benchmark results:
We could consider having the compiler recognize the pattern of switch (with boolean expression as cases) and all return values are either boolean literals or expressions and have the compiler automatically optimize that into a single larger boolean expression.
\cc @bradfitz @minux @martisch
The text was updated successfully, but these errors were encountered: