MATLAB takes a long time to run the same code on my laptop compared to my desktop.

12 views (last 30 days)
I'm quite new to MATLAB. I need to tune a PID controller for my project using Differential Evolution algorithm. The code for the same takes about 200 secs to run on my desktop, for 100 generations. (2 secs for 1 gen) The same code on my laptop takes about 1000 secs. (10 secs for 1 gen) though it is very new. What could be the problem? I bought this laptop for educational purposes and obviously I want it to be fast and quick. Here's the specifications of my laptop and desktop:
  • 2nd Gen. Intel Core i3 2100 @ 3.10 GHz
  • 4 GB DDR3 RAM
  • 500 GB HDD
  • 7th Gen. Intel Core i7 7500U @ 2.70 GHz (base) upto 3.50 Ghz
  • 12 GB DDR4 RAM
  • 256 GB NVME PCIe M.2 SSD
I know desktops are faster than their laptop counterparts. But come on, it's a 7th Gen Core i7 against a 2nd Gen Core i3 and still it loses the battle. Is there something that can be done to decrease the run time?
Thanks in advance.
ZETHEMBE DUMA on 22 Oct 2021
hi can u please share the code for the above task if you got it to, thank you.

Sign in to comment.

Answers (2)

KL on 23 Mar 2017
Profile helps to analyse the execution time & number of calls within the script.
profile on
% code
profile view
This should give you an idea on which part of your program eats up more time.
Good luck, KL
KL on 27 Mar 2017
I don't understand the code snippet but anyway, I would run this specific part of the program separately with some dummy input series and see how it behaves. From there possibly you could break it down to the point where you could optimize your code.

Sign in to comment.

Philip Borghesani
Philip Borghesani on 23 Mar 2017
I think this may be expected Intel "U" processors are not fast they are power efficient.
  • Both processors are 2 cores 4 threads
  • Desktop processor clocks faster
  • Desktop is 75W laptop is 15 (or 7.5 optionally by vendor?) watt
  • Many laptop computers have processor speed artificially limited by (due to) cooling capability. Changing power/fan settings may help.
  • Intel processors have not gotten much faster per clock over the recent generations.
However benchmarks do show that the 7500U is potentially about 50% faster. I would look into utilities to see if your laptop processor is suffering from thermal throttling.

Community Treasure Hunt

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

Start Hunting!