Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Apr 24th, 2005, 12:43 PM   #1
deimos
Newbie
 
Join Date: Apr 2005
Posts: 5
Rep Power: 0 deimos is on a distinguished road
Working out the average complexity of functions?

Hi, Im going to be doing a assessment in ada95 (for my uni course) and part of the write up for my code i have to say how some commands, functions or procedures perform on average, their average complexiy vs their theritic complexity. I dont know what it will be yet (will find out in a week) but im sure i can work out the theroy but how can i measure the performance? write some code to plug x numbers into it in y time? but surely that will vary from pc to pc. was just wondering if there was an established way of goign about this.
thanks
-Deimos
deimos is offline   Reply With Quote
Old Apr 24th, 2005, 1:30 PM   #2
tempest
Programming Guru
 
tempest's Avatar
 
Join Date: Oct 2004
Posts: 1,041
Rep Power: 6 tempest is on a distinguished road
Send a message via ICQ to tempest Send a message via AIM to tempest Send a message via Yahoo to tempest
That's pretty much it but when you report the findings you want to report time to the millisecond and as many relavant system specs as you can.
__________________

tempest is offline   Reply With Quote
Old Apr 24th, 2005, 2:25 PM   #3
deimos
Newbie
 
Join Date: Apr 2005
Posts: 5
Rep Power: 0 deimos is on a distinguished road
Thanks, i will do. is there a way of dispalying how long it takes in ada? a package or something that does this?
deimos is offline   Reply With Quote
Old Apr 25th, 2005, 11:42 AM   #4
Rory
Expert Programmer
 
Rory's Avatar
 
Join Date: Jan 2005
Location: London
Posts: 542
Rep Power: 4 Rory is on a distinguished road
Send a message via MSN to Rory
The mathsy way to do it would be to look at the algorithm, and calculate its order. Say your algorithm had to compare n items of data with all the others (n-1): then the performance of the algorithm would be proportional to (1/2)n*(n-1) , meaning your algorithm was of quadratice order, and you could say that a double in the size of the data would quadruple the time required.
If you then extended it to (k/2)n*(n-1) saying that k was a constant that reflected the power of the computer (say 2^30 for a 1Ghz computer) you could calculate how long it would take to run.
Whilst with more complex algorithms it can be much harder to consider how many operations per item need to be performed, it plays an important role in, for example, graphics-related routines where you need to find out how effeciently it will run on any computer.
Knowing whether your algorithm is of linear, polynomial or exponential order is a good assessment of how efficient it is.
Rory is offline   Reply With Quote
Old Apr 26th, 2005, 4:18 AM   #5
deimos
Newbie
 
Join Date: Apr 2005
Posts: 5
Rep Power: 0 deimos is on a distinguished road
Thanks for the good reply. I dont know yet which algorithms i'll be needing to evalutaue, but this will come in handy thanks.
deimos is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 9:48 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC