Very slow stepping thro code (7000 lines)
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Very slow stepping thro code (7000 lines)
Hi folks
I know this has come up before (from me at least). I am using a stack only script as a behaviour stack. It's convenient as I can use GitHub to track changes. The script is now nearly 7000 lines and I have noticed that it has slowed down as the script has got longer. This is especially noticeable when stepping thro code (usually using "Step Over"). I am using a Mac (Catalina) and each step takes over a second, and all text operations are similar, e.g putting a carriage return. Are there any tricks I can use to shorten the delay?
I am working on transferring to Trevor's Levure. From what I understand we can step using Sublime Text and the the IDE responds. But in any case I would like to speed up native LiveCode for debugging.
Thanks.
Kaveh
I know this has come up before (from me at least). I am using a stack only script as a behaviour stack. It's convenient as I can use GitHub to track changes. The script is now nearly 7000 lines and I have noticed that it has slowed down as the script has got longer. This is especially noticeable when stepping thro code (usually using "Step Over"). I am using a Mac (Catalina) and each step takes over a second, and all text operations are similar, e.g putting a carriage return. Are there any tricks I can use to shorten the delay?
I am working on transferring to Trevor's Levure. From what I understand we can step using Sublime Text and the the IDE responds. But in any case I would like to speed up native LiveCode for debugging.
Thanks.
Kaveh
Kaveh
Re: Very slow stepping thro code (7000 lines)
This may sound canned or trite, but is meant as neither. Mind you, I also don't have Catalina, Lc 9.x, etc to test with.
7k lines in a behavior seems a bit over-much (mind you, I am no expert in behavior scripts either, but I've written full db programs with fewer lines of code than that, so relatively speaking, it sounds a bit much).
Option 2 -
You've gone over the code, and don't think you can eliminate anything (which I find hard to believe)
but if that is the case in fact, break that behavior into multiple script only stacks.
Option 3 -
If neither of the above work, move your computer outside and place an M80 under it, light the wick, watch the fun... Ok, that was both trite and canned, I'm sorry
Go through the code, and make it more efficient. Lots of times, when writing code, you write some code that is overly long or more complex than it need be, but it works (or seems to), so you forget about it.
7k lines in a behavior seems a bit over-much (mind you, I am no expert in behavior scripts either, but I've written full db programs with fewer lines of code than that, so relatively speaking, it sounds a bit much).
Option 2 -
You've gone over the code, and don't think you can eliminate anything (which I find hard to believe)

Option 3 -
If neither of the above work, move your computer outside and place an M80 under it, light the wick, watch the fun... Ok, that was both trite and canned, I'm sorry

Re: Very slow stepping thro code (7000 lines)
Hi Bogs
You can say anything to me and not offence taken! You have helped a lot in the past.
The code was spread around the stack before, but I gradually moved all to one place so a crash would not be so serious. So I just keep track of code in one place.
I agree now that moving related code to several stacks would be better. And there is no doubt the code can be made more efficient. That is what I am trying to do now, but it is painful to do that too because of the slow speed!
I will definitely think of splitting the code now to have 3-4 stacks. In the meantime any more ideas welcome...
Thanks.
K
You can say anything to me and not offence taken! You have helped a lot in the past.
The code was spread around the stack before, but I gradually moved all to one place so a crash would not be so serious. So I just keep track of code in one place.
I agree now that moving related code to several stacks would be better. And there is no doubt the code can be made more efficient. That is what I am trying to do now, but it is painful to do that too because of the slow speed!
I will definitely think of splitting the code now to have 3-4 stacks. In the meantime any more ideas welcome...
Thanks.
K
Kaveh
-
- VIP Livecode Opensource Backer
- Posts: 10043
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: Very slow stepping thro code (7000 lines)
7k lines is not a lot. Which version of LC? And is the problem evident in both debugging and editing?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Very slow stepping thro code (7000 lines)
It has been the same in several versions, from 9.4. I have just moved from 9.5.0 to 9.5.1 stable (all Indy).
Just measured stepping in debug mode from one line to next of simple code around 4-5 seconds which is painful.
It is slow to edit and to step. Enter carriage return takes around a second.
I just tried switching off autocomplete, etc (see screenshot) but no improvement.
Just measured stepping in debug mode from one line to next of simple code around 4-5 seconds which is painful.
It is slow to edit and to step. Enter carriage return takes around a second.
I just tried switching off autocomplete, etc (see screenshot) but no improvement.
Kaveh
Re: Very slow stepping thro code (7000 lines)
FourthWorld wrote: ↑Mon Dec 23, 2019 9:15 pm7k lines is not a lot. Which version of LC? And is the problem evident in both debugging and editing?
Richard would know far more than I, but to me, 7k lines still seems a lot.
I would uncheck all the things in options, especially live errors.

Re: Very slow stepping thro code (7000 lines)
Hi Kaveh,
my central stack's script - used by nearly all my other stacks - contains 426 handlers & 279 functions and occupies 12022 lines & 441972 characters. I experience no execution or edition speed differences dependent on script length(s).
Peter
my central stack's script - used by nearly all my other stacks - contains 426 handlers & 279 functions and occupies 12022 lines & 441972 characters. I experience no execution or edition speed differences dependent on script length(s).
Peter
Re: Very slow stepping thro code (7000 lines)
Thanks. I have no problem with execution. My problem is slow debugging, and editing. Takes 4-5 secs to go from one simple line to another, e.g.
put 5 into a
put 6 into b
and when typing I have to wait for the characters to catch up.
put 5 into a
put 6 into b
and when typing I have to wait for the characters to catch up.
Kaveh
Re: Very slow stepping thro code (7000 lines)
you guys/girls make me curious, what kind of programs is what you make which needs so many handlers and lines?
Re: Very slow stepping thro code (7000 lines)
The more functionality you need, the more lines. I am processing complex text. There is probably some duplication, but I would still have several 1000 lines.
I do have a habit of breaking lines to make them more readable, e.g.
so yes, I could save a huge number of lines if I compact these. I just counted and only 750 such breaks, so would only save 10% of lines.
I do have a habit of breaking lines to make them more readable, e.g.
Code: Select all
local var1, \
var2, \
...
Kaveh
Re: Very slow stepping thro code (7000 lines)
Hi,
have you tried editing/ debugging with a version where you removed those "cosmetic line breaks"? Should be easy to test.
Have fun!
have you tried editing/ debugging with a version where you removed those "cosmetic line breaks"? Should be easy to test.
Have fun!
All code published by me here was created with Community Editions of LC (thus is GPLv3).
If you use it in closed source projects, or for the Apple AppStore, or with XCode
you'll violate some license terms - read your relevant EULAs & Licenses!
If you use it in closed source projects, or for the Apple AppStore, or with XCode
you'll violate some license terms - read your relevant EULAs & Licenses!
Re: Very slow stepping thro code (7000 lines)
Heh, I'm with you. I guess I am just not 'big time' enough to think along lines that large

I also may be suffering from a misconception of the problem as described, though. As described initially, I am thinking the 7k lines are in one behavior script that is not broken up into various functions and handlers, but used in a looping manner in a single handler, and does *not* include the lines of the rest of the program.
Peter, your description sounds more like an average way I see programs written, although that (to me) is still a huge amount of lines for anything short of a small operating system.

Re: Very slow stepping thro code (7000 lines)
Perhaps I described incorrectly. The 7000 lines are the stack script of a script only stack. My main stack has its behaviour set to this stack.I also may be suffering from a misconception of the problem as described, though. As described initially, I am thinking the 7k lines are in one behavior script that is not broken up into various functions and handlers, but used in a looping manner in a single handler, and does *not* include the lines of the rest of the program.
Actually my slow debugging problem is not related to the behaviour stack. You could think of having a stack with a huge stack script, and I would have the same problem.
There are lots of handlers (140) and functions (230). I have very few long handlers and functions. I try to split them up.
I don't see anything unusual in having this many lines and I am not a high level programmer. It's just separate functionalities that I have added as I need them.
Kaveh
Re: Very slow stepping thro code (7000 lines)
Ok, my initial impression was way off then. I have nothing else to offer 


Re: Very slow stepping thro code (7000 lines)
Thanks for some insight, i'm going to count a few (for me challenging) stacks of myself to see how many lines it actually has and the amount of handlers.
Still comparing is of course not easy as one does not know exactly what the stack of someone else tries to accomplish.
I
Still comparing is of course not easy as one does not know exactly what the stack of someone else tries to accomplish.
I