Going Faster by Duplicating Code

In this web content, the author discusses a technique for improving code generation by adding special cases in runtime if statements. By doing so, the compiler can optimize the code based on anticipated runtime information. The author provides examples of how adding branches to a function can lead to faster execution, especially when certain conditions are known at compile time. They also mention the limitations of templates and propose using std::visit in combination with generic lambdas as an alternative. The author emphasizes the importance of measuring performance before forcing code separation.

https://voidstar.tech/code_duplication/

To top