468,146 Members | 1,464 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,146 developers. It's quick & easy.

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

74 64KB
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
1 3262
dseals22
74 64KB
@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.

Similar topics

6 posts views Thread by floortje | last post: by
1 post views Thread by Shawn B. | last post: by
5 posts views Thread by poison.summer | last post: by
15 posts views Thread by Chris | last post: by
1 post views Thread by gcdp | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.