Windows FFI

Todd Fleming todd at flemingcnc.com
Thu Nov 4 02:35:49 PST 2004


Lendvai Attila wrote:

>:: Honestly, right now I don't think it's appropriate to dig to 
>:: deep into Windows specific features given that VC can't even 
>:: properly compile Slate at all. I'd rather wait till I can 
>
>only a note: VC 8 (.NET based) works fine. in fact, iirc, even with full
>optimizations? I will have to take a look at it again...
>
>- 101
>  
>

I've been playing with the optimizations in VS.Net 2003 today. This is 
what I've found:

/Og global  -- ok, but see notes below
/Ob1 inline  -- ok, but see notes below
/Oi intrinsic  -- ok
/Ot favor speed -- ok
/Oy omit frame ptr -- ok
/G7 Pentium 4 -- ok

Things go wrong when /Og and /Ob1 are combined. Either one works in 
combination with the others. I get the best performance with /Og plus 
the others. /O2 combines the full set (except /G7), so it doesn't work 
either. I didn't dare attempt the no-alias options. It's hard to find 
either C or C++ code that isn't loaded with aliases, so that 
optimazation is rarely safe.

Performance: I measured the time it takes to load an image and quit (I 
used typeahead while it loaded). The version built with MSYS GCC takes 
16.2 seconds on my machine. The VC version takes 18.4 seconds (14% 
increase in time). This is on an Athlon 2800+ running XP. I used 
QueryPerformanceCounter(), which has a high resolution.

These results are a bit odd. VC executables almost always outperform GCC 
ones on my machine.

Todd




More information about the Slate mailing list