开发者

XDEBUG profiler results are different each time

开发者 https://www.devze.com 2023-01-12 09:17 出处:网络
Is this normal to get different results each time I execute my code? I\'ve written a small piece of code and whenever I run it, I get different results. Say I call two different functions in my code,

Is this normal to get different results each time I execute my code?

I've written a small piece of code and whenever I run it, I get different results. Say I call two different functions in my code, sometime's the cost of Func1 is 44%, Func2 is 25%, sometimes it's 38%, 33% respecti开发者_开发问答vely!

What should I do to get more accurate results?


In most cases it's impossible to recreate the same results on a dynamic website, various factors like the amount of records in a database and background tasks will skew results. To help make sense of the XDebug results it's probabaly worth installing a nice frontend.

I use Webgrind: http://code.google.com/p/webgrind/

Preview: http://jokke.dk/media/2008-webgrind/webgrind_large.png

It might be worth putting a few var_dumps inside the function to figure when the varied results occur, if you can isolate them you'll know how to speed up the whole function.

0

精彩评论

暂无评论...
验证码 换一张
取 消