Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bench test your PC!
#1
Well, I was bored, so I made a C# app to calculate prime numbers.

.net 2.0 framework required.

Open it, enter:

1000000 (one million)

And wait for it to complete.

Then post the time it shows.

Tips: Close all background applications.

Note that it will get slower as the numbers get bigger.

And if it's taking up CPU, you should expect it!

Download:
http://www.mediafire.com/download.php?1itj42pyohw

..source:

 Spoiler
Reply
#2
Code:
if (i == num)
                {
                    Console.WriteLine(num);
                }

That makes me cry. Writelines are very CPU intensive. Only the end result is needed. Sad

Code:
Stopwatch timer = new Stopwatch();
            timer.Start();
            int num;
            int i;
            for (num = 3; num <= cap; num += 2)
            {
                for (i = 2; i < num; i++)
                {
                    if (num % i == 0)
                    {    
                        break;
                    }
                }
            }

There are other optimizations you could use, but these are some pretty good ones for the moment. I guess it's also because I was trained in the ANSI standard. >_>
Reply
#3
Well it does give us a nice visual representation of the process :3.

My computer is slow. Still going through.

EDIT: Done. 17m 47 seconds.
Reply
#4
Okay, I re-ran it. Here;s my result.

0d, 0h, 5m, 13s taken for 1000000 as cap
Reply
#5
Using the optimized test or the original?

Your computer is much faster than mine either way Sad
Reply
#6
Original. The optimized wasn't faster at all.
Reply
#7
3m 12s.
Reply
#8
3:58. :x
Now let's see who can run the program by hand fastest. Big Grin
Reply
#9
10:52
Reply
#10
9m 47s. D:
Reply
#11
Lol, I actually had a TI-Basic (graphing calculator language) program that spit out prime numbers on my calculator... it took about an entire class period to get from 2 to 8000-ish, when I aborted it. I didn't bother to implement a stopping point, so it would've gone on forever until it ran out of battery.

5:25. What do you know, that's my birthday.
Reply
#12
3:09 - without closing anything
2:51 - closed firefox, media player and a buncha other windows

lol 18 seconds difference.
Reply
#13
13:xx -_- I'm going to fully reïnstall windows soon, because my computer has been slow for the last 2 weeks, even though I clean it all the time...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)