Same code works slower in linux than windows

6 views (last 30 days)
I am wondering whether it is a common problem that same code works slower when it's under Linux. I tested a same code which about RPCA on image, something like image recovery. And I found the executing time is in Win7 100s but 300s in Ubuntu 11.04.
THX advance.
  3 Comments
Andreas Goser
Andreas Goser on 22 Sep 2011
Just to make sure that the OS is the only difference:
Same machines? Same architectures? Same MATLAB Release?
Daniel Shub
Daniel Shub on 22 Sep 2011
Often proprietary video drivers are optimized for Windows and inefficiently reversed engineered for Linux. As Jan said in his answer use the profiler to figure out the difference.

Sign in to comment.

Accepted Answer

Jan
Jan on 22 Sep 2011
Windows 7 has a very advanced memory manager. If the code allocates a lot of temporary memory, this might be the cause of the differences.
If the code accesses the harddisk or the data are located on a network path, there may be further differences caused by the operating system, e.g. the Virus checker or the network device driver.
If the function uses compiled MEX files, there can be a big difference caused by the optimization capabilities of the used compilers. Sometimes the SSE-instructions of the MSVC compiler are excellent, sometimes GCC is much smarter.
Please use the PROFILEr to find the commands, which cause the different speed. Then a more explicite investigation is possible.
  2 Comments
Lofi
Lofi on 28 Sep 2011
Problem solved, THX!
with the assistance of PROFILEr, I found figure and plot cost most execution time in that code. I thought it might due to the inefficiency of display driver under Linux.
After commented that line, the time costs is almost the same with that under Win7.
Thanks a lot~
Daniel Shub
Daniel Shub on 28 Sep 2011
You might be able to see these effects more generally with "bench" and changes in the 2-D and 3-D tasks. You might also be able to modify your code so the drawing is done with an invisible figure. and only showing the figure at the end. This might speed things up again.

Sign in to comment.

More Answers (0)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!