Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Testing Efficiency?
Index -> General Programming
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Geminias




PostPosted: Sat Aug 11, 2007 8:50 pm   Post subject: Testing Efficiency?

What's the best way to compare efficiencies of different algorithms? I tried the "time" command which I believe is the GNU/time(1) command built into bash but the results are staggered for multiple runs of the same program... Also I don't know how to adjust the precision and frankly the documentation both in man and google sucks.
Sponsor
Sponsor
Sponsor
sponsor
Ultrahex




PostPosted: Sat Aug 11, 2007 9:11 pm   Post subject: Re: Testing Efficiency?

Testing multiple cases using the programming languages timer, or computer internal timer/clock cycles for the program. Also checking how many times it iterates through in the program is another way to check efficient such as big O notation.
Geminias




PostPosted: Sun Aug 12, 2007 6:23 am   Post subject: RE:Testing Efficiency?

yeah cool but how? (what program? whats the command?)
PaulButler




PostPosted: Sun Aug 12, 2007 6:16 pm   Post subject: RE:Testing Efficiency?

I think Ultrahex is talking about programming the timer into the program, something like this:

code:

// pseudocode
c = current time;
for (i = 0; i < 1000; i++)
     function_you_want_to_test(arguments, for, this_function);
avgtime = (current time - c) / 1000;
Display posts from previous:   
   Index -> General Programming
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: