PHP Optimization - Eclipse w/ PDT (via XDebug)
How do I use the开发者_运维问答 Debugger to optimize my code? I'm using too much memory, my understanding is that the debugger has built in tools which help with optimizing code?
XDebug, among other things, allows you to profile your code, saving the profiling information to a file, which can be opened by analyzer programs, that can visualize how the control flow went, and how much time was spent in each function.
It helps you find bottlenecks, or slow parts in your code, but it won't directly optimise your code, you have to look at the data, and determine for yourself which parts to refactor.
You can enable the profiler by adding these settings to your php.ini:
xdebug.profiler_enable=1
xdebug.profiler_output_dir=c:\temp\
The documentation about the profiling feature of XDebug can be found on the official page.
精彩评论