Note that there are some explanatory texts on larger screens.

plurals
  1. POCode is slower on Linux as compared to Windows
    primarykey
    data
    text
    <p>After modifying my C code, (written originally for Windows and compiled under VS 2008), I ran it on Linux. To my surprise it is now at least 10 times slower than windows version. </p> <p>Using Profiler tools I figured out that the following function is consuming most of the time spent in the application:</p> <pre><code>/* advance by n bits */ void Flush_Buffer(N) int N; { int Incnt; ld-&gt;Bfr &lt;&lt;= N; Incnt = ld-&gt;Incnt -= N; if (Incnt &lt;= 24) { if (System_Stream_Flag &amp;&amp; (ld-&gt;Rdptr &gt;= ld-&gt;Rdmax-4)) { do { if (ld-&gt;Rdptr &gt;= ld-&gt;Rdmax) Next_Packet(); ld-&gt;Bfr |= Get_Byte() &lt;&lt; (24 - Incnt); Incnt += 8; } while (Incnt &lt;= 24); } else if (ld-&gt;Rdptr &lt; ld-&gt;Rdbfr+2044) { do { ld-&gt;Bfr |= *ld-&gt;Rdptr++ &lt;&lt; (24 - Incnt); Incnt += 8; } while (Incnt &lt;= 24); } else { do { if (ld-&gt;Rdptr &gt;= ld-&gt;Rdbfr+2048) Fill_Buffer(); ld-&gt;Bfr |= *ld-&gt;Rdptr++ &lt;&lt; (24 - Incnt); Incnt += 8; } while (Incnt &lt;= 24); } ld-&gt;Incnt = Incnt; } } </code></pre> <p>This function was taking negligible time on windows. on Linux it is taking taking close to 14 sec. What wrong I have committed here? </p> <p>There are no system calls here so this code section should be independent of OS specific calls and thus should run in identical time. </p> <p>(My Guess: This function is being called multiple times, so may be the profiler is accumulating the time of all the calls too. In such a case I think one of the issues might be that the function is not getting its input parameter quickly as compared to windows case. )</p> <p>What wrong I have committed here? Any guess? </p> <p>Rgrds, </p> <p>H </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload