Time Script execution in milliseconds

Version 1

    A while back, I had a rather large script that was failing because it took too long. The problem wasn't obvious and so I wanted to time different sections of the script to see where the efficiency was lacking. It wasn't too difficult to find the problem, but when I started looking, I had many sections that were taking 0 seconds and total script execution was still about 7 seconds.

     

    I needed to measure in milliseconds and so I found that VB lacked any specific function for this, but Jscript had a function. I never got it to work because I was using a code example that had the wrong case for the function and Jscript is case sensitive. I'm not familiar enough with JScript to have spotted this until after I found my solution in VB, so I kept using the VB method anyway.

     

    This has helped me find bloated sections of scripts and given me cause to learn more by constantly looking to improve the speed of my scripts and squeeze as much juice as I can out of the box I have Kiwi running on.