2012-05-30, 07:29 PM
Hello,
I write plugins for MyBB and I sometimes browse MyBB code. I am always surprised, because MyBB almost always uses PHP functions to typing variables.
Why do not you use cast?
Code is very similar:
vs
But cast is 5-6 times faster than using functions, because it's a PHP construction.
Comparsion examples:
http://hakre.wordpress.com/2010/05/13/ph...vs-intval/
http://stackoverflow.com/questions/23913...ger-in-php
http://forums.devnetwork.net/viewtopic.php?p=343451
I know, it isn't big difference in one case, but MyBB uses inly intval in 1200+ places in the code.
MyBB is big script, so any small changes, can improve overall performance.
I write plugins for MyBB and I sometimes browse MyBB code. I am always surprised, because MyBB almost always uses PHP functions to typing variables.
Why do not you use cast?
Code is very similar:
$foo = intval($bar);
vs
$foo = (int) $bar;
But cast is 5-6 times faster than using functions, because it's a PHP construction.
Comparsion examples:
http://hakre.wordpress.com/2010/05/13/ph...vs-intval/
http://stackoverflow.com/questions/23913...ger-in-php
http://forums.devnetwork.net/viewtopic.php?p=343451
I know, it isn't big difference in one case, but MyBB uses inly intval in 1200+ places in the code.
MyBB is big script, so any small changes, can improve overall performance.