how to improve performance? cpu vs ram vs operating system

10 次查看(过去 30 天)
Hi,
I have recently started using matlab ( any type of programming actually) and I dont know if i need to buy a new laptop. I am keeping all my files on google drive and work from uni on desktop or home on laptop.
The desktop pc has i7 cpu at 3.2 Ghz and 6 GB ram, windows 8.1 enterprise.
Laptop has i5 cpu at 2.3 Ghz and 12 GB ram, windows 7 pro.
When i run the same code it takes 450 seconds on my desktop and 912 seconds on my laptop.
Do you think the difference is normal? Any suggestion?
Thanks
Turker
  2 个评论
James Tursa
James Tursa 2017-1-12
Given the different environments a 2x factor in execution timing is not necessarily out of the ordinary. We would have to know more about MATLAB versions used, what your code is doing, where it is reading files from in each case, etc. to give a more informed response.
ttopal
ttopal 2017-1-12
Hi James, My code forms/solves linear algebraic system. 256x256 is most common size I use. I sometimes run fsolve function in a loop around 100 times to calculate and solve my system for different parameters. Odd enough the laptop has ssd drive while the desktop has sata drive. Both are 2016b versions. My conclusion is speed mainly depends on cpu.

请先登录,再进行评论。

采纳的回答

Jan
Jan 2017-1-12
If you mainly solve small linear algebra systems, the CPU has the main influence on the speed. Many i5 laptop processors have 2 cores and the i7 4 cores. Together with the higher frequency and turbo-boost this could explain the factor of 2.
While you can easily buy hardware for the double speed, improving the software can yield a speedup of factor 100:
Vectorization, parallelization, pre-allocation, efficient data structuring and loop optimization, the application of a suitable solver, preferring code which is treated well by Matlab's JIT acceleration (no eval, no changes of the type of variables), inplace operations and using fast libraries for BLAS or Mex functions.

更多回答(1 个)

Walter Roberson
Walter Roberson 2017-1-12
My laptop has an i7 at 2.6 GHz with 8 Gb of memory -- a slightly better CPU than yours, a slightly faster clock right, less memory. I would not say that my system is slow (but it could be faster.) I would not expect a 3.2 Ghz machine to run twice as fast, all other things being equal.
However:
  • possibly the desktop has a faster disk drive and you might be handling files a lot
  • possibly the desktop has more cores and your task might happen to work well with additional cores. If you are running vectorized calculations on fair-sized matrices, this is a definite possibility
My laptop has 4 physical cores; it would not be uncommon these days for a desktop to have 8 physical cores.

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by