Note that there are some explanatory texts on larger screens.

plurals
  1. POSwitched compiler - performance dropped - Trying to understand why
    primarykey
    data
    text
    <p>I'm writing a Ruby C Extension that computes the "soft selection" of a set of vertices. It's many iteration where the distance between 3d points are computed.</p> <p>Initially I used Pelles C IDE - based it on a template I had found.</p> <p>I then made an update, where I switched to using <code>nmake</code> that comes with Visual Studio C++ Express 2010. What I found was a performance drop - which was odd because if anything it should have been faster.</p> <p>I then reverted back to the original code I had written in Pelles C and compiled it with <code>nmake</code> and found that the exact same code was slower.</p> <p><strong>Pelles C</strong></p> <pre><code>&gt; Updating soft selection took 0.741 seconds (12176 of 21692 Vertices) &gt; Updating soft selection took 0.751 seconds (10911 of 21692 Vertices) &gt; Updating soft selection took 0.859 seconds (10765 of 21692 Vertices) &gt; Updating soft selection took 0.753 seconds (10653 of 21692 Vertices) &gt; Updating soft selection took 0.75 seconds (10747 of 21692 Vertices) &gt; Updating soft selection took 0.751 seconds (10822 of 21692 Vertices) </code></pre> <p><strong>Visual Studio</strong></p> <pre><code>&gt; Updating soft selection took 1.282 seconds (11853 of 21692 Vertices) &gt; Updating soft selection took 1.273 seconds (12204 of 21692 Vertices) &gt; Updating soft selection took 1.286 seconds (11720 of 21692 Vertices) &gt; Updating soft selection took 1.248 seconds (12996 of 21692 Vertices) &gt; Updating soft selection took 1.293 seconds (10705 of 21692 Vertices) &gt; Updating soft selection took 1.276 seconds (12204 of 21692 Vertices) </code></pre> <p>I'm very inexperienced with C and compiling - but I assume that the performance difference is due to differences between the compiler and the compile instructions?</p> <p>For the <code>nmake</code> version I used the Makefile produced by <code>extconf.rb</code> - for the Pelles C version I used whatever the setting was for the sample project I found.</p> <p>Am I right in that it's the <code>CFLAGS</code> that's important here?</p> <p><strong>CFLAGS?</strong></p> <p>For the Pelles C project is is: <code>CCFLAGS = -Tx86-coff -MD -Ot -Ox -W1 -Gd -Ze -Zl#</code></p> <p>For the <code>nmake</code> project it is: <code>CFLAGS = -MD -Zi -O2b2xg- -G6</code></p> <p>When I looked up <code>CFLAGS</code> and performance it usually mentioned the flags <code>O</code>, <code>O2</code> and <code>O3</code> - now I see an <code>O2</code> in the <code>nmake</code> Makefile, but with an odd set of trailing characters.</p> <p>The Pelles C project has <code>Ot</code> and <code>Ox</code> ... ?</p> <p>I was unable to work out the meaning of these. The extension will be compiled under Windows and OSX (PPC and Intel). What configuration of the compiler can I do to get the most performance out of it? At least restore the performance I had.</p> <p><strong>Makefile and Pelles C configuration</strong></p> <p>Here is a Pastie of the <code>nmake</code> Makefile: <a href="http://pastie.org/3543595" rel="nofollow">http://pastie.org/3543595</a></p> <p>Here is a Pastie of the Pelles C project file: <a href="http://pastie.org/3543597" rel="nofollow">http://pastie.org/3543597</a></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