Subroutine Call Is Expensive
The prologue and epilogue associated with each procedure are ``overhead''
that is necessary but does not do user computation.
- Even in scientific Fortran, procedure call overhead
may account for 20% of execution time.
- Fancier languages have higher procedure call overhead.
- Relative overhead is higher for small procedures.
- Breaking a program into many small procedures increases execution time.
- A GOTO is much faster than a procedure call.
- Modern hardware architecture can help:
- Parameter transfer
- Stack addressing
- Register file pointer moved with subroutine call