First of all, I'd never touch .NET unless I'd need it in my job (and my current job isn't programming related ;)). So yeah, I'm doing it with pure VB6: no API, no type libraries, no assembler etc. With a listbox it takes the steady 5 ms to show 1000 primes in the listbox (9 ms in the IDE). I formatted my code so that if the people who time the codes want to, they can leave out the listbox.
As for the algorithm, it is my own, since I didn't find any premade one. This is the first time I'm doing something with the prime numbers :) I have no idea what algorithms others might have.
Current version can count up to 32767 prime numbers (as many as you can put in the listbox without errornous behavior) at about 250 ms, listbox slowdown included (730 ms in IDE). I might submit this as it is now, as I guess I can do only minor optimization from now on that doesn't really matter.
Edit I got interested on seeing more accurate results. I took out the listbox from the timing, made the whole algorithm loop 100 times and these are my results for single run times:
- 0,83 ms to get 1000 primes compiled
- 5,22 ms to get 1000 primes under IDE
- 117 ms to get 32767 primes compiled
- 620 ms to get 32767 primes under IDE
