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

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

问题描述

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

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

或者失败了如何在 JavaScript 中做到这一点?

Or failing that how to do it in 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天全站免登陆