I’m slowly getting a grip on how to profile modx.
A thing which fooled me a bit was the cache. So if any warnings take place, it will be only one time, so, after the page is cached those warnings don’t show up the next time, which gave me the "idea" the phpError() function didn’t add overhead.
Now see this:
documentParser->executeParser(); -> 88.0 %
documentParser->parseDocumentSource -> 58.0 %
documentParser->invokeEvent -> 56.0 %
documentParser->parseProperties -> 53.0 %
documentParser->phpError -> 53.0 % !!!!!!!!!!!!!
So, about 60% of the time spend in executeParser is spoiled in phpError() :-(
Note though that the total time spend in executeParser is roughly half the time spend in total php processing time.
But still, if a page isn’t cached, it’s clear that the phpError() function gives a lot of overhead, just by doing nothing actually. (Well, if you run with warnings on, you will see that those warnings are from index out of bound problems)
Regarding ob_start() and ob_end(), I can’t measure a performance difference, so if you want to use it to trap snippet/plugin errors, no problem I guess.
But keep an eye on that one...
Well, a single warning doesn’t add really that much of an overhead you know.
One ’wrong’ $_GET[’blah’] has non measurable performance impact really.
I saw however this one, which is weird performance wise:
in index.php
define(IN_MANAGER, 'false')
Heh, I put it there myself you know, cause, in document.parser.blah we check for that value:
if (IN_MANAGER)
//do something
For a cached page, so the phpError() doesn’t show up, this one single if statement is good for 5 % of the time spent in executeParser() !!!!!
Either this has to be fixed or done differently, in any case, it’s just to cpu consuming for one single if() statement!
Remon
P.S.
Surpressing warnings!!???
Of course not. Make your code clean and working ;-)
(At least when it’s possible of course.)