Execution Speed of mex64 components in linux
6 views (last 30 days)
Show older comments
All, I have written a GUI based application in R2011b which was compiled into a standalone application. It runs fine but its slow running under linux.
I have generated several mex64 components that run under the GUI with the gcc 4.2 compiler in linux and the current Microsoft C SDK under windows 7.
Windows 7 Matlab script function #1 27.11 sec function #2 246.9 sec.
Red Hat Matlab script function #1 33.30 sec function #2 661.81 sec
Red Hat Stand-alone app function #1 33.71 sec function #2 653.17 sec
The same code was used on all platforms. Does the gcc compiler generate non-optimized code compared to the Microsoft SDK? The difference in run times for function #2 is 2.5X... Thanks, Jim
0 Comments
Accepted Answer
Ken Atwell
on 29 Mar 2012
It certainly seems that the Microsoft compiler has the edge in this situation! Can we assume you are controlling for other variables to the extent reasonable? That is, you are running on comparable computers at similar clock frequencies, etc. If function #2 involves a tight inner loop, even a modest differences in optomizations can have a magnified effect.
Make sure you are using (at least) the -O switch to gcc. Within MATLAB, you can use the -v switch to the mex function to confirm it is being used. You can experiment with more aggressive settings via the "CFLAGS" variable. This Stack Overflow question may give you some ideas.
More Answers (0)
See Also
Categories
Find more on MATLAB Compiler in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!