Code in live script run much slow
Mostrar comentarios más antiguos
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 comentarios
Lukas Müller
el 25 de Nov. de 2017
Editada: Lukas Müller
el 25 de Nov. de 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
el 24 de Feb. de 2019
Editada: per isakson
el 7 de Ag. de 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
el 28 de Feb. de 2020
Does anyone know if the speed issue extends to Live Functions?
per isakson
el 7 de Ag. de 2020
Editada: per isakson
el 7 de Ag. de 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
el 8 de Feb. de 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?
Respuesta aceptada
Más respuestas (7)
Gijs van Oort
el 31 de Mayo de 2017
5 votos
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 comentarios
Gijs van Oort
el 28 de Jun. de 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
el 8 de Abr. de 2024
I agree with Gijs. Live editor is way slower even on really good spec machines even with R2023b
Prannay Jain
el 15 de Nov. de 2016
4 votos
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 comentarios
Xinyu Zhang
el 15 de Nov. de 2016
Ninad Chaudhari
el 11 de Nov. de 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
el 14 de En. de 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
el 8 de Mzo. de 2018
Yes, the latency associated with editing of live scripts is frustrating. Any workaround for this?
Pierre-Francois
el 15 de Mzo. de 2018
Editada: Pierre-Francois
el 15 de Mzo. de 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
el 13 de Mayo de 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
el 14 de En. de 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
el 9 de En. de 2017
Editada: Tom Anderson
el 16 de En. de 2017
2 votos
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 comentario
Tom Anderson
el 16 de En. de 2017
Editada: Tom Anderson
el 16 de En. de 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
el 11 de Dic. de 2019
2 votos
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
el 25 de Mzo. de 2017
1 voto
I will definitely use this feature more when resource allocation improves.
Frieder Wittmann
el 28 de Mayo de 2018
0 votos
Has this been addressed in R2018a? Didn't see anything in the release notes.
2 comentarios
Will Perdikakis
el 28 de Ag. de 2018
Nope. Still brutally slow edits and execution.
Frieder Wittmann
el 3 de Mayo de 2019
We're at 2019b now and despite all the advertisement for the future it is still unusable slow :-(
Juan José Trujillo
el 17 de Sept. de 2018
0 votos
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 comentarios
Kouichi C. Nakamura
el 17 de Sept. de 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
el 26 de Sept. de 2018
Editada: Frieder Wittmann
el 26 de Sept. de 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
el 7 de Nov. de 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
el 18 de Dic. de 2018
Thank for the information about the backstage of Jupyter. Yeah, that makes sense!
Categorías
Más información sobre Integration with Online Platforms en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!