[normalized Sound] A deep dive into dispatching techniques - Jonathan Müller - Meeting C++ 2022

preview_player
Показать описание
A deep dive into dispatching techniques - Jonathan Müller - Meeting C++ 2022

At the core of an interpreter is a loop that iterates over instructions and executes them in order. This requires dispatching: based on the current instruction, it needs to select different code. A fast interpreter requires a fast instruction dispatcher, but so does everything else that needs to switch over a fixed set of different options.

This talk investigates at various dispatching techniques, from virtual functions over simple switch statements to jump tables. We'll look at performance analysis tools, benchmarks, and lots and lots of assembly code, in order to learn ways to trick the compiler into generating the assembly code that we actually want.

Even if you don't need to actually write an interpreter or other dispatcher, you will learn a lot about optimization.
Рекомендации по теме
Комментарии
Автор

Great talk!! I have a sense that the performance issue you saw for call-threading was “branch target” related (similar to what was noted for the laptop case) which was mitigated in the token-threading approach by the multiple branches that could be separately learned. Perhaps unrolling the loop in the call-threading approach could have helped. I also wonder if the compiler flag “-march=native” could have generated better (and different) switch-statement code for the different platforms

Roibarkan
Автор

20:15 I suspect the goto statement in slide 43 should only have the label location, without “argument passing” in parentheses.

Roibarkan
Автор

Great talk, but please talk at a slower pace, you are almost impossible to understand at times.

sargijapunk
Автор

34:20 I wonder if the [[unlikely]] attribute could have made a difference here

Roibarkan