Code in live script run much slow
Afficher commentaires plus anciens
The new matlab live script functionality is really awesome, thanks matlab team.
But I observe that my code run considerably slower in live script than in the command line. Just out of curiousity, is this an expected result for a newly created function or there is some way to configure the amount of resource allocation for live script? Thanks.
5 commentaires
Lukas Müller
le 25 Nov 2017
Modifié(e) : Lukas Müller
le 25 Nov 2017
just want to add my case to the needed update in performance in matlab livescript. The following code
x1_ini = -147143866;
x2_ini = 3391949;
v1_ini = -0.68641;
v2_ini = -30.2659;
max_dev = 0.1*6371;
earth_sun = 149600000;
orbit = 2*pi*earth_sun;
v = norm(v1_ini+v2_ini);
dt = 1;
while true
n = 1;
while v*dt*n < (orbit-max_dev)
n = n+1;
end
if v*dt*n + v*dt > (orbit+max_dev)
break
end
dt = dt+1;
end
dt_max = dt-1; %= 24
takes a couple of seconds as .m file and isn't yet finished computing after 3 hours as livescript ...
Noam Segev
le 24 Fév 2019
Modifié(e) : per isakson
le 7 Août 2020
It is a bit ungainly, but you can save the file as .m file and run the heavy sections from this file, and then continue with livescript for sections that needs the represenations.
Matt J
le 28 Fév 2020
Does anyone know if the speed issue extends to Live Functions?
per isakson
le 7 Août 2020
Modifié(e) : per isakson
le 7 Août 2020
Executions of functions are not affected as far as I can see on R2018b.
I copied the code of the comment above by Lukas Müller into an ordinary m-function and a Live Editor mlx-function. tic/toc reports the same elapse time for the two
>> live_function_test
Elapsed time is 0.145617 seconds.
>> live_function_test_LE % Live Editor
Elapsed time is 0.143375 seconds.
P.S. I did a similar comparison with scripts. The m-script finished in about the same time as the functions. I interupted the live-script after a minute.
feynman feynman
le 8 Fév 2024
"
Code in live script run much slow
" is this talking about live script on a local pc (offline) or online? Is running offline still much slower than in m files?
Réponse acceptée
Plus de réponses (7)
Gijs van Oort
le 31 Mai 2017
5 votes
The most annoying I think, is that editing is much slower too. After pressing a key, it takes noticeable time for the character to be shown on the screen. Also walking through the code with the arrow keys and scrolling are really slow. Due to this, I'm now ending up writing my code in a normal .m script and copying it to the .mlx when I'm happy with the results.
2 commentaires
Gijs van Oort
le 28 Juin 2017
In the LiveScript, I was displaying some very long symbolic equations. I found out that this greatly reduced speed and responsiveness. It was useless anyway; 90% of the displayed equation would be typeset off the screen. After I disabled the displaying of the equations (adding a ; after the assignment), the thing became much faster (but still slower than I would wanted it to be)
Manoj
le 8 Avr 2024
I agree with Gijs. Live editor is way slower even on really good spec machines even with R2023b
Prannay Jain
le 15 Nov 2016
4 votes
Yes, the code runs slower in the live script than in the command line. Currently, there is no way to configure the amount of resource allocation for the live script.
I work for MathWorks and I have forwarded this feedback to the appropriate product team.
7 commentaires
Xinyu Zhang
le 15 Nov 2016
Ninad Chaudhari
le 11 Nov 2017
1 year later, The code still runs painfully slow as compared to normal "m" file or command window! Really want to use the live script feature, but the speed just kills it !
Jan Kappen
le 14 Jan 2018
Any updates on that? It's still extremely slow. Not only the execution but the input/scrolling as well. Brave new world of web apps...
Ronan Fleming
le 8 Mar 2018
Yes, the latency associated with editing of live scripts is frustrating. Any workaround for this?
Pierre-Francois
le 15 Mar 2018
Modifié(e) : Pierre-Francois
le 15 Mar 2018
Any news on this topic? The awful sluggishness of the live script makes this otherwise very promising and appealing tool completely useless. Really too bad !
Jan Kappen
le 13 Mai 2018
I have the feeling, being behind a corporate proxy makes things much worse. When I'm at home office without proxy the editor is much quicker. Do you experience the same?
Dom Dwyer
le 14 Jan 2019
has this been fixed yet? we can't work with this product currently as it is too slow even on new computers
Tom Anderson
le 9 Jan 2017
Modifié(e) : Tom Anderson
le 16 Jan 2017
2 votes
Please improve this! It's almost 50% slower to run .mlx versus .m...
I ran a code section for a live file using "Run Section" that took 72.971023 seconds. The same code .m file using "Run Section" took 52.701320 seconds. Repeated this test multiple times and .mlx is always a loser.
That's not very good. It's almost a 50% slowdown. It's not as though there's any extra interactivity between the code, either. Just waiting for the results both times, with the GUI locked up.
1 commentaire
Tom Anderson
le 16 Jan 2017
Modifié(e) : Tom Anderson
le 16 Jan 2017
Here's a great example I found to run much slower:
tic
for t = 1:1000000
if ~mod(t, 10000), disp(t), end
end
toc
The live code (.mlx): Elapsed time is 487.6064 seconds.
Hit F9 to run (or run as script): Elapsed time is 0.010989 seconds.
50,000 times slower? What gives?
Florian Blanchet
le 11 Déc 2019
2 votes
Hi,
Can you remove that feature or at least make it clear that is significantly slower and will reduce editor experience ?
How can you provide a feature that is so unusable without make it explicit it is still experimental ?
Ryan
le 25 Mar 2017
1 vote
I will definitely use this feature more when resource allocation improves.
Frieder Wittmann
le 28 Mai 2018
0 votes
Has this been addressed in R2018a? Didn't see anything in the release notes.
2 commentaires
Will Perdikakis
le 28 Août 2018
Nope. Still brutally slow edits and execution.
Frieder Wittmann
le 3 Mai 2019
We're at 2019b now and despite all the advertisement for the future it is still unusable slow :-(
Juan José Trujillo
le 17 Sep 2018
0 votes
Hi,
I do not know what is the motivation for you to use the live scripts. I really find this a cool way of documenting and something which approaches a bit what you can do in Jupyter Notebooks.
In fact, I have been using successfully Jupyter Notebooks with the matlab engine in the last two years to run matlab code. I have worked that way since I have some python background and did not know live scripts until recently. Just lately I have got in touch with matlabs live scripts through a colleague and we have noticed latency which I do not experience through Jupyter Notebooks. I guess the mechanics here are really different and the Notebook approach almost resembles running bare scripts with a bit of overhead on the matlab engine.
Maybe you can give Jupyter Notebook a try and get better performance and with slightly better documentation capabilities with markdown.
4 commentaires
Kouichi C. Nakamura
le 17 Sep 2018
Correct me, if I'm wrong, but I thought MATLAB engine for Jupyter notebook is not MATLAB per se. I assumed that many of newly added MATLAB functions or class constructors/methods won't run.
I really do think Markdown is superior to LiveScript's mark up. But if the most of code won't run, I cannot use Jupyter. So I have been wishing that at some point MathWorks might adopt markdown.
Or if there is a way to run official licensed MATLAB for Jupyter, then please let me know.
Frieder Wittmann
le 26 Sep 2018
Modifié(e) : Frieder Wittmann
le 26 Sep 2018
I use Jupyter and like it but still prefer MATLAB due to its build in debugger, profiler and access to the workspace. Also, I like that I can run commands in the command window and combine this with results from scripts.
Juan José Trujillo
le 7 Nov 2018
Hi Kouichi, sorry for answering that late. I am not really into it. But, As I understand the Matlab engine in Jupyter is just a thin wrapper which passess commands straight to a headless matlab instance. In fact any time a launch a matlab notebook I get fully new instance of Matlab working in the background. So I think you get the best of both worlds, or almost depending on the application. As Frieder says, still there are several applications that you do not have access to from the Jupyter Notebook.
A really cool application of this is for instance if you work on a remote headless system with long lived sessions. You just turn on and off your graphical interface (web browser) locally and connect to the server when you need it, but the Jupyter server and matlab instance stay alive on the remote side. I think you cannot do this kind of things with the matlab IDE, or correct me if I am wrong.
Kouichi C. Nakamura
le 18 Déc 2018
Thank for the information about the backstage of Jupyter. Yeah, that makes sense!
Catégories
En savoir plus sur Integration with Online Platforms dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!