laggy issue of code editor in R2018b

I am using Macbook Pro 2014. 2.6Ghz i5 processor, 8GM 1600Mhz memory. I installed two versions of matlab, 2015a and 2018b. When I edited my codes in 2015a, everything is fine. However, running 2018b on the same machine, the code editor is very laggy. By "laggy", I mean when I simply tried to move the cursor or type some texts, it may respond after 1-2 seconds. Sometimes, the left bottom corner popped out info "processing...". I didn't see this info in the previous matlab version. Is the new version running something new in the back to cause this laggy issue? Am I the only one having this problem?

3 Comments

Having the same problem on my MacBook Pro 2017. Went back to R2018a, which shows none of this behaviour.
I'm having the same issue with a MacBook Pro 2015. 2018a has no issues
Thanks,guys! Someone tested it on macbook pro 2018 and it was fine there. I guess I'll simply go back to R2018a.

Sign in to comment.

Answers (4)

Kris Fedorenko
Kris Fedorenko on 3 Oct 2018
Edited: Kris Fedorenko on 3 Oct 2018
There were instances of similar behavior in R2018b caused by the Magnet app. Turning it off should resolve the issue. Alternatively, you should be able to use keyboard shortcuts with no delays.

8 Comments

Thanks a lot for the answer! I searched on my mac for the magnet app. It seemed it is not a default app for the OS system and I didn't use it. (I was using High Sierra OS and the split view function when I trie to manage work window. I didn't use this function when I was running Matlab, though.) So I suppose in my case it is not the Magnet App causing this issue? By using keyboard shortcuts, I suppose you mean using arrow keys to move the cursor. In fact, that's what I did and the code editor was still laggy. Let me know what you think. Many thanks in advance! :-)
Rui Wang
Rui Wang on 7 Nov 2019
Edited: Rui Wang on 7 Nov 2019
Instantly resolved my issue! Wow magnificent. Same issue with Macbook pro 2015 and Matlab 2019b. Resovled this issue simply setting magnet to ignore Matlab.
thanks a lot. it perfectly solved my problem!
Wow, this fixed it instantly. Thanks!
Wow that solved the problem, indeed ! isn't it possible to exclude Matlab from the inputs Magnet needs to analyse ?
Quitting magnet solved the problem. Fantastic find!
I haven't seen any way to opt-out Matlab from Magnet but if anyone has suggestions please share
When Matlab is open, you can go into the Magnet settings via the menu-bar dropdown and tick "Igonre Matlab" – resolved the issue for me!

Sign in to comment.

Fan Zhang
Fan Zhang on 27 Jun 2019
I encoutered the same problem on both r2018b and r2019a. The solution is to turn off Magnet.
Hope it helps.
Daniel Pantea
Daniel Pantea on 22 Oct 2018
Edited: Daniel Pantea on 22 Oct 2018
Seems not only MAC is affected. I have same delays in Windows 7 x64. Tested same script and: - with R2018b it needed 23.4s to process the data. - with R2018a it needed 17.21s to process the same data. I have to go back to R2018a as in some situations the display gets unresponsive for seconds with R2018b! Hope they come with some patches, else this is a step back...

5 Comments

Just installed older R2017a and with it I got 15.52s, which slightly better even compared to R2018a. Compared with R2018b it's almost half!
I did more tests and installed older versions (with 2016a my script was incompatible so I stopped there). I did 3 tries with each version. Between try 1 and try 2 I completely exited and restarted Matlab and between try 2 and try 3 I only restarted the script. Below are the results. The winner is 2017a however 2017b is very close. But 2018b clearly is far behind. All these tests I did on Win7 x64 with same script and same input data.
_
Version tic/toc result as "Elapsed time is xx seconds"
Try 1 Try 2 Try 3 Average
2016b 14.762806 14.935183 14.605913 14.76796733
2017a 13.497024 13.604032 13.143465 13.41484033
2017b 13.143465 14.256278 13.858204 13.752649
2018a 14.967507 14.433997 14.433997 14.61183367
2018b 21.618891 22.884296 21.82832 22.11050233
_
I recommend sending your data processing script to Technical Support and working with the Support staff to determine the cause of this slowdown (as well as hopefully a solution or workaround.)
Thanks, Daniel, for this very detailed test! Apparently there are other people having this issue. Below is another related post:
https://www.mathworks.com/matlabcentral/answers/421446-r2018b-runs-very-slow-on-macos-10-14?s_tid=answers_rc1-2_p2_BOTH
I didn't get to test the running time for some script because the laggy issue of typing text in the script already stops me from doing that. Some people solve the problem by turning of the Magnet app. But some people have the same issue when they are not window splitting app installed. Hope they can come up with a fix.
I got great help from support and they identified a place of optimization which reduced the consumed time about 10 times! Details are below and after that the elapsed time difference from 2018b vs 2018a was insignificant:
  • 17a: 1.931015 seconds.
  • 18a: 2.253766 seconds.
  • 18b: 2.268560 seconds.
Here's detail of the improvement (which are specific to my case) I received from support:
Around line 775 in the SCRIPT.m, there is a very tight loop:
for i = 1:N1
k = min(i, mean_len);
my_mean = (my_mean*(k-1)+hUI.preprocessed{1}{ch}(i)) / k;
hUI.preprocessed{3}{ch}(i) = my_mean;
end
Using temporary variables to hoist some of the indexing out of the loop will make a huge difference:
tempVar3 = hUI.preprocessed{3}{ch};
tempVar1 = hUI.preprocessed{1}{ch};
for i = 1:N1
k = min(i, mean_len);
my_mean = (my_mean*(k-1)+tempVar1(i)) / k;
tempVar3(i) = my_mean;
end
hUI.preprocessed{3}{ch} = tempVar3;

Sign in to comment.

Yan Zhang
Yan Zhang on 23 Jan 2019
For anyone who is still interested, I updated my OS to Mojave (10.14.2) and the laggy issue of R2018b disappears.

Asked:

on 30 Sep 2018

Commented:

on 23 Apr 2022

Community Treasure Hunt

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

Start Hunting!