Page 9 of 12 FirstFirst ... 456789101112 LastLast
Results 81 to 90 of 113

Thread: Counting

  1. #81
    Overclocking Guru Trace's Avatar
    Join Date
    Aug 2007
    Location
    California
    Posts
    2,077

    Default Re: Counting

    Can't wait!
    Quote Originally Posted by Lothair View Post
    I guess it's just widely used and has had some of the best people in the world work on it, costing a ridiculous amount of money, for no actual reason. :/
    Have you checked out the front page lately?
    Projects:
    Moe's Tavern | Sponsored by: Mimo Monitors, Crucial, Thermaltake
    Book Of Knowledge

  2. #82
    Ceann na Drochaide Bige! XcOM's Avatar
    Join Date
    Mar 2006
    Location
    Sheffield (UK)
    Posts
    2,990

    Default Re: Counting

    And the results are in, honstly im suppurised at them.

    And helix, your app didn't have a counter and you didn't reply with a revision that did so, in efect your app does not have any scores becuase i couldn't get any.



    Mary had a little lamb. It bumped into a pylon. Ten thousand volts went up its arse and turned its wool to nylon!

  3. #83
    Ceann na Drochaide Bige! XcOM's Avatar
    Join Date
    Mar 2006
    Location
    Sheffield (UK)
    Posts
    2,990

    Default Re: Counting

    its strange i think, VB has 2 out of 5 victorys and Java has 2 out of 5, and C++ has only 1 out of 5.

    I was expecting C++ to wipe the floor with everything, but apperently not!


    Mary had a little lamb. It bumped into a pylon. Ten thousand volts went up its arse and turned its wool to nylon!

  4. #84
    iShot the Sheriff jdbnsn's Avatar
    Join Date
    Jan 2006
    Location
    Normal
    Posts
    8,241

    Default Re: Counting

    so who won?
    "At the midpoint on the journey of life, I found myself in a dark forest, for the clear path was lost..." -Dante Alighieri

  5. #85
    Water Cooled silverdemon's Avatar
    Join Date
    Jun 2006
    Location
    Delft, Netherlands
    Posts
    520

    Default Re: Counting

    Quote Originally Posted by jdbnsn View Post
    so who won?
    Yeah, who won?

    I can see that VB (my program) wins in the shorter countings, but java (trace) takes over at the larger numbers. Also C++ (Mtekk) is quicker at those numbers.
    It seems to me that both Java and C++ count faster, but the program takes a little time to initialize or somthing, since the lower numbers all take about 15-16ms...

    Anyways, good job you all!
    now: let's see the sources

  6. #86
    Resident EE mtekk's Avatar
    Join Date
    Dec 2007
    Location
    Minnesota
    Posts
    469

    Default Re: Counting

    Quote Originally Posted by XcOM View Post
    its strange i think, VB has 2 out of 5 victorys and Java has 2 out of 5, and C++ has only 1 out of 5.

    I was expecting C++ to wipe the floor with everything, but apperently not!
    In all reality, there are much faster ways of doing this in C++, but mine was the quickest to write, and kept with the STL. I wrote it in the middle of two weeks filled with midterms. Prince probably used vectors, but probably didn't do any preallocation which decreases performance (mine preallocated before counting). I think the timing method I used isn't necessarily the best either, it's resolution is a little low (has a resolution of 1ms).

    I'd like to see the code silverdemon used. Mine is in the bottom of this post.

    Just out of curiosity, did you do multiple runs and average them? And what system specs?

    Here's my code
    Code:
    /*
    John Havlik
    4-18-2008
    Count Benchmark
    */
    #include <iostream>
    #include <vector>
    #include <fstream>
    #include <ctime>
    using namespace std;
    
    int main()
    {
    	clock_t start, end, elapsed;
    	vector dump;
    	unsigned char foo;
    	unsigned int count(1000000), temp(0);
    	do
    	{
    		cout << "How many iterations do you want to do?\n";
    		cin >> temp;
    		count = ++temp;
    		dump.assign(count, 0);
    		start = clock();
    		while(--count)
    		{
    			dump[count] = count;
    		};
    		end = clock();
    		elapsed = end - start;
    		cout << "For " << temp << " loops (count from 0 to " << temp - 1 << ")\n We took: " << elapsed << " ms \n Saving...";
    		ofstream fout;
    		fout.open("count.out");
    		for(unsigned int i(0); i < temp; i++)
    		{
    			fout << dump[i] << endl;
    		}
    		fout.close();
    		dump.clear();
    		cout << " Done.\nWould you like to run again?(y/n)\n";
    		cin >> foo; 
    	}
    	while(foo == 'y');
    	return 0;
    }
    Quote Originally Posted by xRyokenx View Post
    ...I'm getting tired of not being able to figure this crap out because it's apparently made for computer-illiterate people by computer-illiterate people. lol

  7. #87
    Overclocking Guru Trace's Avatar
    Join Date
    Aug 2007
    Location
    California
    Posts
    2,077

    Default Re: Counting

    Well, who won?
    My code is below.
    I entered the second 1.

    If you want my VB6 code let me know.(PM)

    Java (with output):
    Code:
    import java.io.File;
    import java.io.FileNotFoundException;
    import java.io.PrintStream;
    import java.util.Scanner;
    class Count2 
    {
    	
    	public static void main(String args[]) throws FileNotFoundException 
    	{
    		Scanner input = new Scanner( System.in );
    		PrintStream diskWriter = new PrintStream( "D:/java/numbers.txt" );
    		System.out.print( "Enter number to count to: " );
    		int countto = input.nextInt();
    		int count = 0;
    		long time = System.currentTimeMillis();
    		while (count < countto)
    		{
    			count = count + 1;
    			diskWriter.println( count );	
    		}
    		long timeTook = System.currentTimeMillis() - time;
    		System.out.println("It took you "+timeTook+"ms to count to "+count);
    	}
    }
    Java(without output):
    Code:
    import java.util.Scanner;
    
    public class Count
    
    {
    	public static void main( String args[] )
    
    	{
    		Scanner input = new Scanner( System.in );
    		System.out.print( "Enter number to count to: " );
    		int countto = input.nextInt();
    		int count = 0;
    		long time = System.currentTimeMillis();
    		
    		while ( count < countto)
    		{
    			count = count + 1;
    		}
    		long timeTook = System.currentTimeMillis() - time;
    		System.out.println("It took you "+timeTook+"ms to count to "+count);
    	}
    }
    Quote Originally Posted by Lothair View Post
    I guess it's just widely used and has had some of the best people in the world work on it, costing a ridiculous amount of money, for no actual reason. :/
    Have you checked out the front page lately?
    Projects:
    Moe's Tavern | Sponsored by: Mimo Monitors, Crucial, Thermaltake
    Book Of Knowledge

  8. #88
    Resident EE mtekk's Avatar
    Join Date
    Dec 2007
    Location
    Minnesota
    Posts
    469

    Default Re: Counting

    Just for fun I opened up Mathematica and did some plots of the times. For the following plots, orange is Trace, blue is me (mtekk), red is Silverdemon, and green is Prince.

    Here's Trace's Time vs. Count graph

    Here's My Time vs. Count graph

    Here's Silverdemon's Time vs. Count graph

    Here's Prince's Time vs. Count graph

    Here is a combined, graph on the common axis of Prince's plot.
    Last edited by mtekk; 04-27-2008 at 04:29 PM. Reason: Fixed the combined plot
    Quote Originally Posted by xRyokenx View Post
    ...I'm getting tired of not being able to figure this crap out because it's apparently made for computer-illiterate people by computer-illiterate people. lol

  9. #89
    Resident EE mtekk's Avatar
    Join Date
    Dec 2007
    Location
    Minnesota
    Posts
    469

    Default Re: Counting

    Quote Originally Posted by Trace View Post
    Well, who won?
    My code is below.
    I entered the second 1.

    If you want my VB6 code let me know.(PM)
    Err, that second one isn't actually storing the count. Unless I'm missing something
    Quote Originally Posted by xRyokenx View Post
    ...I'm getting tired of not being able to figure this crap out because it's apparently made for computer-illiterate people by computer-illiterate people. lol

  10. #90
    Overclocking Guru Trace's Avatar
    Join Date
    Aug 2007
    Location
    California
    Posts
    2,077

    Default Re: Counting

    Wait, I think that's the one I entered. I'm not completely sure actually.
    Quote Originally Posted by Lothair View Post
    I guess it's just widely used and has had some of the best people in the world work on it, costing a ridiculous amount of money, for no actual reason. :/
    Have you checked out the front page lately?
    Projects:
    Moe's Tavern | Sponsored by: Mimo Monitors, Crucial, Thermaltake
    Book Of Knowledge

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •