VBA Speed Results
A few days ago I posted a VBA procedure that looped 100 million times. I asked readers to run the code and report on how long it took. See How Fast Is Your System?
About 60 people responded, and here's how the times were distributed:
It's certainly not a normal distribution. The times are skewed towards the faster end of the scale.
- Mean: 13.25 seconds
- Median: 11.29 seconds
- Fastest: 5.08 seconds
- Slowest: 28.52 seconds
So, the fastest machine ran the code about 5.6 times faster than the slowest machine.
But the real question is, how long would it take to do this task manually?
I wrote 0 on a piece of paper and I flipped a coin. If it came up heads, I added one to my tally. If it came up tails, I subtracted 1. I did this ten times and it took me 42 seconds. So, one time through my "loop" took 4.2 seconds. Using this information, I calculated that it would take me 799 years to perform this task 100 million times -- but only if I work non-stop. The conclusion: My computer is about 52.3 million times faster than I am.
Spreadsheet Page Blog
Welcome to the Spreadsheet Page Blog. This is where you find the latest news on my books, add-ins, and other Excel-related topics. Comments are welcome.
