sat*_*isa 9 javascript profiler internet-explorer
我有一个用例,我需要获取我的网页加载时执行的Javascript行总数.
我面临的问题是,当一定数量的JS执行超过时,浏览器会抛出警报(我认为在IE的情况下为500万)并且页面被挂起.
我使用了IE开发人员工具栏中提供的分析器,但它给出了所调用的JS函数的总数,但不是执行的行数/总数.
任何帮助表示赞赏.
谢谢
在 BASH 中:
wc -l file.js
Run Code Online (Sandbox Code Playgroud)
在 PHP 中:
<?php
$c=0;
$file_handle = fopen("file.js", "r");
while (!feof($file_handle)) {
$line = fgets($file_handle);
$c++;
}
fclose($file_handle);
print "$c lines.\n";
?>
Run Code Online (Sandbox Code Playgroud)
在 Node.js 中:
var i, count = 0, js=require('fs').createReadStream('file.js');
js.on('data', function(chunk) {
for (i=0; i < chunk.length; ++i)
if (chunk[i] == 10) count++;
});
js.on('end', function() {
console.log(count);
});
Run Code Online (Sandbox Code Playgroud)
尝试缩小以减少行数。
不过,这似乎是一个可怕的代码量。
| 归档时间: |
|
| 查看次数: |
927 次 |
| 最近记录: |