0

What is the toll of a function call? Is looping 200,000 times calling a function that performs a small calculation each time a lot more resource intensive than just performing that small calculation inline?

2
Contributors
1
Reply
2
Views
10 Years
Discussion Span
Last Post by Ezzaral
1

Well, according to this http://hudzilla.org/phpwiki/index.php?title=Avoid_overusing_function_calls it is, and zend.com has the following to say on it

Function calls carry a high overhead. You can get a bump in performance if you eliminate a function. Compiled languages, such as C and Java, have the luxury of replacing function calls with inline code. You should avoid functions that you only call once. One technique for readable code is to use functions to hide details. This technique is expensive in PHP.

in this page about optimizing php http://www.zend.com/zend/trick/trick-optimizing-php.php

Votes + Comments
Interesting links
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.