Skip to content

Instantly share code, notes, and snippets.

@rianhunter
rianhunter / call_overhead.c
Last active December 21, 2023 23:25
Indirect vs Direct Function Call Overhead in C/C++
/*
This benchmark shows how indirect function calls have nearly
the same overhead costs as direct function calls.
This is comparing apples to apples, factoring out the savings
due to inlining optimizations that direct calls usually afford.
From this, it seems that inlining and other generic interprocedual
optimizations are the main drivers of direct function call optimization,
not the direct call itself.