1. Home
  2. Computing & Technology
  3. Visual Basic

Which is faster? VB 6 or VB.NET?

By Dan Mabbutt, About.com

4 of 8

Coding My Own Benchmark

Throwing caution to the wind, I decided to see if I could write my own benchmark!

Here are my criteria. Trash them if you must!

  1. I decided to go for a strictly command line (that is, DOS) executable to avoid the many differences between VB 6 forms and VB.NET forms.
  2. It seemed that Robert's benchmark fell victim to the fact that executing a tight loop a million or so times doesn't measure the right things. I decided to go for a reasonably long and difficult calculation instead.
  3. I incorporated a library that does I/O and can be used directly by both VB 6 and VB.NET: Scripting.FileSystemObject and an API call to GetTickCount in the "Kernel32" library for timing.

The calculation I used was the calculation of prime numbers. The program used was published on the web in the paper "A Report on Algorithms for Prime Numbers" by Mehmet Shala. (Incidental note: One of the debugging problems I had was that todays computers are so fast, I couldn't believe I was actually measuring the elapsed time of the calculation. I eventually settled on a calculation of the first 100,000 prime numbers to get a directly comparable number.)

Here's the code! It works remarkably well in both VB 6 and VB.NET!

Explore Visual Basic
By Category
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. Visual Basic
  4. Opinions and Humor
  5. A benchmark investigation into the relative performance speed of VB 6 versus VB.NET

©2009 About.com, a part of The New York Times Company.

All rights reserved.