问题描述
与xdebug + webgrind类似,这给我们在文件中的每个函数执行的时间非常糟糕,我想知道如何进行优化以及检测慢的JavaScript函数。
Similar to xdebug+webgrind which gives us the rough time for execution for each function in a file etc, I am wondering how to go about optimizing as well as detecting slow javascript functions.
确定firebug可能会这样做,但不知道如何?有人可以指导我如何检测内存泄漏呢?如何判断功能是否太慢?我的意思是有任何基准,例如。在PHP中,我有一个粗略的想法,任何脚本需要超过200ms的执行时间,有点慢/也许可以重构。我的代码执行大概需要几秒钟,这样我的浏览器体验就不会迟缓?我知道它是一个模糊的问题,但有没有任何基准?
Am sure firebug can probably do this, but am not sure how? Can someone guide me as to how to detect memory leaks also? How do I decide if a function is too slow? I mean is there any benchmark, for e.g. in PHP i have a rough idea that any script which requires more than 200ms execution time, is kinda slow/maybe can be refactored. Roughly how many seconds should my code execute so that my browser experience is not sluggish? I know its a vague question... but are there any benchmarks?
在发布公共代码之前,我应该遵循哪些步骤?
Is there some kind of steps which I should follow before releasing code for public use?
非常感谢你的时间。
推荐答案
我觉得Fireunit的功能调用分析将是优化的最佳解决方案。
I think that Fireunit's function call profiling would be the best solution for optimization.
这篇关于检测Javascript内存泄漏优化代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!