On Sat, Mar 8, 2008 at 9:56 AM, Platonides Platonides@gmail.com wrote:
DanTMan wrote:
So to cut down on that, I'm going to try using normal string functions to pull out the prefixes and trim them off. A strpos, substr, and trim set together is much quicker than a full blown regex pattern match.
Not always. Remember that the PHP code surrounding that functions is interpreted, while the regex call is run on compiled code. I think some of the sysadmins remarked that the use of regex *improved* the perfomance. I'm not saying you shouldn't change it to traditional means, just that time should be checked to be sure it's not slower.
Or you should just ignore the difference and use whichever you think is easier to read. There's no point in micro-optimization like this, unless you have reason to believe that the particular functions are important to performance.