Author |
Topic: Line numbers are slower (Read 556 times) |
|
jorgerhv
New Member
member is offline


Posts: 1
|
 |
Re: Line numbers are slower
« Reply #1 on: Aug 7th, 2015, 1:01pm » |
|
Would you share the code ? Thanks
|
|
Logged
|
|
|
|
Richard Russell
Administrator
member is offline


Posts: 1348
|
 |
Re: Line numbers are slower
« Reply #2 on: Aug 7th, 2015, 3:37pm » |
|
on Aug 7th, 2015, 1:01pm, jorgerhv wrote:| Would you share the code ? |
|
Just to clarify, the presence of line numbers doesn't of itself result in a slowing of the program. It's only their use as the destination of a GOTO, GOSUB or RESTORE that is (relatively) slow.
So you can leave the line numbers, if you wish, but adding labels as the destination of branches can speed things up a little.
Richard.
|
|
Logged
|
|
|
|
Monkfish
Full Member
member is offline


Gender: 
Posts: 104
|
 |
Re: Line numbers are slower
« Reply #3 on: Aug 7th, 2015, 6:57pm » |
|
The code to strip out line numbers and replace them with labels? Sure. To use it you have to paste your code to a text file, save the altered version back to a text file and then copy it back into LB or LBB.
...but before I do, are there any instructions other than GOTO GOSUB THEN and ELSE that can be followed by a line number?
|
|
Logged
|
|
|
|
tsh73
Full Member
member is offline


Gender: 
Posts: 210
|
 |
Re: Line numbers are slower
« Reply #4 on: Aug 7th, 2015, 7:25pm » |
|
I used to use REMLINE.BAS (easily googled) to remove extra line numbers. That is, ones not used as destination.
(again, this will leave exactly only line numbers which slow down LBB )
|
|
Logged
|
|
|
|
Monkfish
Full Member
member is offline


Gender: 
Posts: 104
|
 |
Re: Line numbers are slower
« Reply #5 on: Aug 7th, 2015, 7:33pm » |
|
Yes, I was sure someone must have written something similar
|
|
Logged
|
|
|
|
Richard Russell
Administrator
member is offline


Posts: 1348
|
 |
Re: Line numbers are slower
« Reply #6 on: Aug 7th, 2015, 7:36pm » |
|
on Aug 7th, 2015, 6:57pm, Monkfish wrote:| ...but before I do, are there any instructions other than GOTO GOSUB THEN and ELSE that can be followed by a line number? |
|
As I stated in my earlier reply, RESTORE is another. In fact it's the only use of a label which doesn't have a better alternative. GOSUB can be replaced by CALL, event handlers can use SUBs, and GOTO is avoidable altogether by using DO or WHILE. Oh, and ON ERROR GOTO can be replaced by TRY...CATCH!
Richard.
|
|
Logged
|
|
|
|
|