Same code works slower in linux than windows

1 次查看(过去 30 天)
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 个评论
Andreas Goser
Andreas Goser 2011-9-22
Just to make sure that the OS is the only difference:
Same machines? Same architectures? Same MATLAB Release?
Daniel Shub
Daniel Shub 2011-9-22
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.

请先登录,再进行评论。

采纳的回答

Jan
Jan 2011-9-22
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 个评论
Lofi
Lofi 2011-9-28
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 2011-9-28
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.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by