分析 javascript 执行的最佳方法是什么? [英] What is the best way to profile javascript execution?

查看:34
本文介绍了分析 javascript 执行的最佳方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有好的 JavaScript 分析器?我知道 firebug 对分析代码有一些支持.但我想确定更长期的统计数据.假设您正在构建大量 javascript 代码,并且想要确定代码中的实际瓶颈是什么.起初,我想查看每个 javascript 函数和执行时间的配置文件统计信息.接下来是包含 DOM 函数.这与诸如渲染树上的操作之类的减慢操作相结合将是完美的.我认为如果性能在我的代码、DOM 准备或渲染树/视觉更新中被扼杀,我认为这会给人一个很好的印象.

Is there a good profiler for javascript? I know that firebug has some support for profiling code. But I want to determine stats on a longer scale. Imagine you are building a lot of javascript code and you want to determine what are actually the bottlenecks in the code. At first I want to see profile stats of every javascript function and execution time. Next would be including DOM functions. This combined with actions that slows things down like operation on the rendering tree would be perfect. I think this would give a good impression if the performance is killed in my code, in DOM preparation or in updates to the rendering tree/visual.

有什么接近我想要的东西吗?或者什么是实现我所描述的大部分内容的最佳工具?它会是一个自编译的浏览器加上通过配置文件功能增强的 javascript 引擎吗?

Is there something close to what I want? Or what would be the best tool to achieve the most of what I've described? Would it be a self compiled browser plus javascript engine enhanced by profile functionality?

推荐答案

Firebug

Firebug 提供非常详细的分析报告.它会告诉你在一个巨大的(详细的)表中每个方法调用需要多长时间.

Firebug

Firebug provides a highly detailed profiling report. It will tell you how long each method invocation takes in a giant (detailed) table.

console.profile([title])
//also see
console.trace()

您需要调用 console.profileEnd () 来结束您的配置文件块.在此处查看控制台 API:http://getfirebug.com/wiki/index.php/Console_API

You need to call console.profileEnd () to end your profile block. See the console API here: http://getfirebug.com/wiki/index.php/Console_API

Blackbird(官方网站)还有一个更简单的分析器(可以从这里)

Blackbird (official site) also has a simpler profiler (can be downloaded from here)

这篇关于分析 javascript 执行的最佳方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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