![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Apr 2005
Posts: 5
Rep Power: 0
![]() |
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 |
|
|
|
|
|
#2 |
|
Programming Guru
![]() |
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.
__________________
|
|
|
|
|
|
#3 |
|
Newbie
Join Date: Apr 2005
Posts: 5
Rep Power: 0
![]() |
Thanks, i will do. is there a way of dispalying how long it takes in ada? a package or something that does this?
|
|
|
|
|
|
#4 |
|
Expert Programmer
|
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. |
|
|
|
|
|
#5 |
|
Newbie
Join Date: Apr 2005
Posts: 5
Rep Power: 0
![]() |
Thanks for the good reply. I dont know yet which algorithms i'll be needing to evalutaue, but this will come in handy
thanks. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|