how to improve performance? cpu vs ram vs operating system
12 views (last 30 days)
Show older comments
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 Comments
James Tursa
on 12 Jan 2017
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.
Accepted Answer
Jan
on 12 Jan 2017
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.
0 Comments
More Answers (1)
Walter Roberson
on 12 Jan 2017
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.
0 Comments
See Also
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!