Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Paul Jones' Blog:
Benchmarking call_user_func_array()
Sep 23, 2005 @ 10:44:14

With another look at benchmarking today, Paul Jones has posted this new item over on his blog with some results of testing the call_user_func_array() function.

Andreas Korthaus wrote the Savant mailing list recently with some interesting benchmark numbers on Savant3 and the output escaping routines. He wrote up a quick template script (in PHP of course) and used the Savant eprint() method 300+ times to escape output (which itself uses only htmlspecialchars() by default).

Then he ran the script; the time to run was 161ms, so I changed my templates not to use output escaping - 12ms!!!

Digging deeper into the code, he finds that the slowdown was related to the use of the call_user_func_array() function calling the escaping functions (like htmlspecialchars), compounding the time it takes to run them. He provides some stats as well for a few different variations on calling the same functions with some interesting results...

tagged:

Link:


Trending Topics: