in reply to Performance issues with subroutines/methods

Note that tweaking the subroutine calling will only help if your application is CPU bound and you are making lots of calls to short subroutines. If you're doing heavy data processing, your app might be I/O bound or memory-starved.

If you are being affected by subroutine calling speed, it's often the case that you have a single subroutine which is being called many times. You should be able to see this in the profiler.

If you only have a few call sites (places where you call this function) you can simply remove the function call overhead by manually inlining the function in those places (with appropriate comments). Of course, this isn't good coding style in general, but optimising for speed generally involves de-optimising for maintainability.

  • Comment on Re: Performance issues with subroutines/methods