0

I'm pretty new to php and absolutely new to profiling, so please forgive me if my question is a little bit "simple".

So enabled xdebug and downloaded Kcachegrid to begin profiling, read through what I could find. My problem is that I'd like to improve speed, but whenever I view my xdebug reports in Kcachegrid, the same script with the same hardware runs with a merely different execution time (form 1.1 to 1.9 sec). I'm executing it on localhost so that I do not have to deal with network speed.

i've read this pretty good article from John Lim http://phplens.com/lens/php-book/optimizing-debugging-php.php and in his article he's dealing with fix execution time. I don't know what I am doing wrong or how could i get fix times so I can see if I get actually better results.

Any advice would be appriciated, or any resource you have read and found useful on php profiling. Thanks for replies!

5
  • Please clarify, you're looking for a faster profiler? Or ways to speed up your script? Commented Apr 18, 2013 at 13:38
  • Actually I am looking for a method to determine how much improvement could i achieve. I found pretty much improvement tactics, but after implementing them I don't really know what to look at in my reports to decide if those improvements are good for me. As execution time always differs, without any code modifiction, I don't know how to determine if my code is actually executed faster Commented Apr 18, 2013 at 13:58
  • Your question is more "generic" than "simple". Without knowing what you're doing, generic questions get generic answers. it's like asking "how do I get better grades?" Well, study. 1 tip I can give right now is that if by localhost you mean your computer, then the differing exec time could be affected by other tasks running at the same time. Maybe look into a local dedicated server. Commented Apr 18, 2013 at 16:36
  • Hi @Soemarko, Thanks a lot for the answer. I looked into local dedicated server, but found no solution so far. Would appreciate very much if you could probably deal with me a little more, i suppose you've got the right answer, I need to ask the question right. As I need to be a little bit more explicit, and space is limited here I'm sharing some more detailed description of what i want to achieve, would appreciate very much, if you read it through and probably contact me with some solution. Thanks in advance. Shared file here: soemarko.net-face.org/soemarko.txt Commented Apr 18, 2013 at 23:22
  • Lol, it's just a local server. Use an old computer or notebook that dedicated to xampp, nothing else. Maybe run linux with lamp there, less background tasks. 1+ sec runtime is a long time not to jump into IM or twitter or browsing something else. Commented Apr 19, 2013 at 5:58

1 Answer 1

1

xdebug is good but I found XHprof an extension written by Facebook for its production profiling works a lot better. It shows you the Wall times of all functions and the stack of the call and can drill down to many levels and see the wall time on each call. You can also compare and consolidate similar calls and compare them over a period of time. Have a look at the demo on XHprof and its a very simple extension to implement. Its a matter of enabling a header and footer and you are off to the races.

http://xhprof.io/

Cheers, Thusjanthan

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.