Function call overhead benchmarks with MATLAB, Octave, Python, Cython and C
Andr\'e Gaul

TL;DR
This paper benchmarks the overhead of function calls across MATLAB/Octave, Python, Cython, and C to identify optimization opportunities in high-frequency call scenarios like finite element methods.
Contribution
It provides a comparative analysis of function call overheads in multiple languages and highlights potential optimization strategies for computationally intensive loops.
Findings
C has the lowest function call overhead.
Python and MATLAB/Octave have significantly higher overheads.
Cython reduces Python's function call overhead effectively.
Abstract
We consider the overhead of function calls in the programming languages MATLAB/Octave, Python, Cython and C. In many applications a function has to be called very often inside a loop. One such application in numerical analysis is the finite element method where integrals have to be computed on each element in a loop. The called functions can often be evaluated efficiently but the function call itself may be time-consuming. We present a benchmark whose goal is to identify and quantify optimization potentials with respect to time consumption caused by function calls in the mentioned programming languages.
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsComputational Physics and Python Applications · Numerical Methods and Algorithms · Parallel Computing and Optimization Techniques
