PHP Xdebug分析-了解检查内容 [英] Php Xdebug Proflling - Understand what to check

查看:86
本文介绍了PHP Xdebug分析-了解检查内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是XDebug的新手.我认为它就像一个必备"工具,可确保应用程序即时消息编码正确完成.

I'm new with XDebug. I see it like a "must have" tool to make sure the app im coding is done well.

这是我的设置: -Macbook Air上的MAMP. -在PHP.INI中激活了Zend XDebug -用于报告的Webgrind

Here's my setup : - MAMP on Macbook Air. - Zend XDebug activated in PHP.INI - Webgrind for reports

我进行了所有配置,以使探查器运行,并且效果很好.

I made all the configuration to make the profiler running and it works great.

关于此的我唯一的问题是我应该怎么看和担心. 有人说整个php进程的最大时间不应超过100毫秒,越接近50毫秒越好.

My only question about this is what should I look and worry about. Some people says that the whole php process shouldn't be over 100ms maximum, closer to 50ms the better.

好的,那是一个很好的开始...

Ok well, thats a good start...

任何机构都可以更清楚地检查什么,可以接受什么,不可以接受什么?

Any body could be more clear on what to check, what is acceptable and what is not?

谢谢.

推荐答案

与可接受的内容无关.

更多的是看花很多时间在做什么,看看是否可以想办法减少这种情况.

It's more a matter of seeing what it is spending a lot of time doing, and seeing if you can think of a way to reduce that.

如果您通过Ctrl-C或Escape或其他方法中断xDebug,xDebug将显示堆栈跟踪,这是非常有用的信息.

xDebug shows stack traces if you interrupt it (by Ctrl-C, or Escape, or whatever), and that is very useful information.

例如,假设它花了40%的时间分配内存,然后一次只能执行一次,或者多次解析某个字符串而一次只能执行一次,或者两者都不用,则将其丢弃我们中的一些人可能会提前猜测,但是一旦您看到它,您就打着头说:我可以为那件事做些什么!"

For example, suppose it is spending 40% of its time allocating some chunk of memory, and discarding it, when it could be done just once, or parsing some string multiple times when it could be done just once, or something neither of us could guess ahead of time, but once you see it, you slap your head and say "I can do something about that!"

好吧,当您中断它时,您有40%的机会(在堆栈上)看到它. 一次又一次地打断它,直到您两次看到它为止. 平均而言,它应该占用2/0.4个中断,或大约5个. 当您两次看过它时,您会发现多汁的加速. (直到您看到它两次,您才知道它是多汁的.)

Well, when you interrupt it, there's a 40% chance you will see it (on the stack). Interrupt it again, and again, until you've seen it twice. On average it should take 2/0.4 interrupts, or about 5. When you've seen it twice, you've found a juicy speedup. (You don't know it's juicy until you see it twice.)

然后冲洗并重复一次,因为以前较小的东西现在占时间的百分比较大.您将很快使代码变得与任何人一样快.

Then rinse and repeat, because something that was smaller before is now a larger percent of the time. You will quickly make the code as speedy as anyone's.

这篇关于PHP Xdebug分析-了解检查内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆