如何在VBScript或JavaScript中测量代码执行时间? [英] How to measure code execution time in VBScript or JavaScript?

查看:174
本文介绍了如何在VBScript或JavaScript中测量代码执行时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

VBScript 中衡量代码执行时间的好方法是什么?

What is a good way to measure code execution time in VBScript?

或者如何在 JavaScript

推荐答案

对于VBScript,你可以使用Timer:

For VBScript you can use Timer:

StartTime = Timer()
EndTime = Timer()
Response.Write("Seconds to 2 decimal places: " & FormatNumber(EndTime - StartTime, 2))

ASP Profiler (适用于ASP环境。)

Or ASP Profiler (that is for an ASP environment.)

对于JavaScript,您可以使用日期:

For JavaScript you can use Date:

var start = new Date().getTime()
alert("Milliseconds: " + (new Date().getTime() - start))

Firebug 还有一个JavaScript分析器。

Firebug also has a profiler for JavaScript.

这篇关于如何在VBScript或JavaScript中测量代码执行时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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