VBScript (ASP) computing program running time, accurate to milliseconds

Source: Internet
Author: User

 

Let the server execute 0.5 million addition (Integer Operation) and 0.2 million open side (floating point operation) to record the time used. < BR />
< %
Dim I, T1, T2, tempvalue, runtime1, runtime2
' Start to calculate the time required for the first addition
T1 = Timer ()
For I = 1   To   500000
Tempvalue =   1   +   1
Next
T2 = Timer ()
Runtime1 = Formatnumber (T2 - T1) * 1000 , 2 )

' Start to calculate the time required for 0.2 million times of Opening
T1 = Timer ()
For I = 1   To   200000
Tempvalue =   2 ^ 0.5
Next
T2 = Timer ()
Runtime2 = Formatnumber (T2 - T1) * 1000 , 2 )
% >
& Nbsp; < Font color = Red > < % = Runtime1 % > Millisecond </ Font >
& Nbsp; < Font color = Red > < % = Runtime2 % > Millisecond </ Font >

The running result on the author's own computer is

Let the server execute 0.5 million addition (Integer Operation) and 0.2 million open side (floating point operation) to record the time used.
203.13 Ms 156.25 Ms

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.