Programming long script gets extremely slow
Show older comments
Hi, im currently writing a script in R2016a. It is 18k lines long right now, and it's done for about 25%. However, the programming gets really slow right now (it did since about 12-15k lines). The running of the script goes just fine, but when I try to edit it it severely lags: whatever I type into the code takes several seconds to actually appear. Does anyone else have similar experience with this issue and an idea on how to fix it? Thanks a lot!
3 Comments
Rik
on 18 May 2017
I'm really curious about what on earth you could be writing that would be 72k lines long.
In general, it is good for code performance to split your functions over several files. That also improves a modular method of coding, as it will be easier to improve performance of those smaller sub-units.
Is there a compelling reason why your code has to be in a single file? Otherwise the solution seems pretty obvious to me.
Stephen23
on 18 May 2017
72000 lines of code in one file... ouch! That sounds impossible to write correctly, and impossible to debug. Why not just use the simple methods that everyone else uses: split code into functions, write OO code, make sure that is is vectorized and follows the other good MATLAB practices... ?
Adam
on 18 May 2017
I'm highly uncomfortable with one of my GUIDE m-files that is 1320 lines long and that even includes lots of lines of automatically created stuff. I can't imagine writing even a function tens of thousands of lines long, let alone a script!
Accepted Answer
More Answers (0)
Categories
Find more on MATLAB 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!