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

15 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:
Desktop
  • 2nd Gen. Intel Core i3 2100 @ 3.10 GHz
  • 4 GB DDR3 RAM
  • 500 GB HDD
Laptop
  • 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.
  3 Comments
Brathindara Suresh
Brathindara Suresh on 24 Mar 2017
Both my desktop and laptop are running windows 10. Desktop has a 32 bit version while my laptop has 64 bit version. Desktop runs R2013b and my laptop runs R2015a.
ZETHEMBE DUMA
ZETHEMBE DUMA on 22 Oct 2021
hi can u please share the code for the above task if you got it to zethembeduma061@gmail.com, thank you.

Sign in to comment.

Answers (2)

KL
KL on 23 Mar 2017
Hi,
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
  4 Comments
Brathindara Suresh
Brathindara Suresh on 24 Mar 2017
Thanks a lot for your tip. Opened a detailed view in the profile window. I've attached a snapshot of the same. I don't have antivirus software on my laptop nor my desktop. It's just windows defender on both. Both systems have Intel HD graphics. (different versions, ofc)
Part of code that takes the most time: (it's a function) syms s; s=stepinfo(tf([0.1*kd 0.1*kp+10*kd 0.1*ki+10*kp 10*ki] , [0.0004 0.0454 0.555 1.51+10*kd 10*kp+1 10*ki]));
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.

Categories

Find more on Introduction to Installation and Licensing 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!