What affects the time for a function to return to the caller. : <p>I measure the run time of two algorithms. </p>

<p>my main() function calls two algorithms and measures the time respectively. </p>

<p>Assume A() and B() are the names for the algorithms. </p>

<p>what I did was like (please ignore details here)</p>

<pre><code>begin = 
A();
end = 
cout &lt;&lt; "time A : " &lt;&lt; end-begin &lt;&lt; endl;
begin = 
B();
end = 
cout &lt;&lt; "time B : " &lt;&lt; end-begin &lt;&lt; endl;
</code></pre>

<p>and I also measure the time inside of each function. 
for example, </p>

<pre><code>A()
{
    begin = 
    .....
    end = 
    cout &lt;&lt; "time inside A : " &lt;&lt; end - begin &lt;&lt; endl;
    return ..;
}
B()
{
    begin = 
    .....
    end = 
    cout &lt;&lt; "time inside B : " &lt;&lt; end - begin &lt;&lt; endl;
    return ..;
}
</code></pre>

<p>It seems the time measuring in main() function and inside of A() function has very little difference. (like 150 milliseconds) 
but for the B(), it has more than 1500 milliseconds difference. </p>

<p>So, I would like to know what can affect this big difference between two functions call.</p>
