|
|
|
|
|
by slver
1878 days ago
|
|
Thoughts in my head: - Go was designed with simple compiler, because the purpose of it wasn't best performance at all costs, but simple code and fast compilation. - Instead we watch as people try to second-guess their processor and alter their code to optimize the machine code produced. Defeating the purpose of Go? - I've actually seen cases where removing the branches slows down code. People have learned that branching is interesting to the CPU, and have decided that no branching means "faster". Actually branching is perfectly fast, when the predictor is right (most of the time). You only want to avoid branching where the predictor does poorly. Anyway, I think only do these tricks in very hot spots of your code, and backed by a solid benchmark to confirm improvement. |
|