检测Javascript内存泄漏优化代码 [英] Detecting Javascript Memory Leaks & Optimizing Code

查看:116
本文介绍了检测Javascript内存泄漏优化代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

与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.

http://ejohn.org/blog/function-call-profiling/

这篇关于检测Javascript内存泄漏优化代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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