422,767 Members | 1,136 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 422,767 IT Pros & Developers. It's quick & easy.

How do I calculate the absolute speed of this algorithm below?

P: 74
If the time it takes to execute a memory access is 100 nanoseconds and that all other operations (arithmetic, register accesses, etc.) take 10 nanoseconds, and what if I have this formula, do you think it would be possible to calculate it then? I am pretty sure this problem can be used to calculate the absolute speed. I know that we do have one of variables already which is Ta= 100 nanoseconds, right? The rest of the missing variables could be found through the lines of code I have provided? Here the formula for the absolute speed :
T= Tna Nna + Ta Na

T= Absolute speed of the algorithm

Tna= the time to execute a memory nonaccess instruction

Nna= the number of memory nonaccess machine language instructions executed

Ta= the time to execute a memory access instruction

Na=the number of memory access machine language instructions executed

Here is the line of code that can (in addition to what I have said) be put into some of the variables, but I am just confused which lines should go to which variables? Do I have to first figure which lines are memory access meaning that store or reserve space in memory and then I would able to plug them into the formula? Any suggestions would be much appreciated. Thanks!

for(int=0; i<1000000; i++)
if(data[i]< 0)
data[i]= data[i] * 2;
Sep 11 '17 #1
Share this Question
Share on Google+
1 Reply

P: 74
@Frinavale Can you help me?
Sep 11 '17 #2

Post your reply

Sign in to post your reply or Sign up for a free account.