O'Reilly logo

Special Edition Using Microsoft® Visual Basic® .NET by Jeff Spotts, Brian Siler

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Measuring Execution Time

The System.Environment namespace has a TickCount property, which returns the number of milliseconds relative to an internal system timer. (This value is slightly different from the Ticks value discussed in Chapter 6, “Storing Information in Variables,” because it represents milliseconds rather than nanoseconds and is stored in a variable of type Integer.) However, it is a great tool for measuring execution time, because we are not interested in the actual time value itself, but rather duration.

→ For more on dates and time spans, see Chapter 6, “Storing Information in Variables,” p.139

Listing 26.4 shows how you can subtract tick counts to determine the time it takes to execute a method:

Listing 26.4. PERFORMANCE.ZIP ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required