Parsing protobuf at 2+GB/s: how I learned to love tail calls in C (2021)

An exciting new feature in the Clang compiler guarantees tail calls in C, C++, and Objective-C using special statement attributes. Tail calls have enabled impressive speed results in protobuf parsing, reaching over 2GB/s, an innovation that sheds light on the power of this technique for performance optimization. While tail calls have been around for a while, Clang’s new guarantee has opened up new possibilities for fast, efficient code. By turning interconnected functions into separate block calls via tail calls, developers can overcome compiler limitations, achieving optimal code quality and performance. While non-tail calls present challenges, tail call optimization remains a promising strategy for improving code efficiency in major language interpreters.

https://blog.reverberate.org/2021/04/21/musttail-efficient-interpreters.html

To top