2024-05-07 08:54 PM - last edited on 2024-09-26 01:06 PM by Doreena Deng
Hi,
I have created an object that is quite slow on loading and changes. I read in the past about speeding up script by using a _ before a variable to constrain the the GDL reader to only look for a variable within that page. Does this speed up the processing time? Are there any other ways to speed up the processing time of the script?
For the _ addition before a variable, is it true that it works only in the same page of the script e.g. when in the Masterscript page:
variable1 = input1 ! Would this search all pages including Master, 2D, 3D, Parameter, Interface pages?
variable1 = _input1 ! Would this search only within the Master page?
Many thanks in advance, Matt
Solved! Go to Solution.
2024-05-08 03:03 AM
@GDL Enthusiast wrote:
I read in the past about speeding up script by using a _ before a variable to constrain the the GDL reader to only look for a variable within that page. Does this speed up the processing time?
I have not heard of this.
As far as I know, it will not make any difference, and is just a naming convention so you can easily tell in the script that it is a parameter.
The question is, why do you need to state that variable1 = input1 ?
If that is always the case then just use input1.
But if somewhere else in the script variable1 = input2, then that could be a valid thing to do.
As for the efficiency of your script, it is really hard to say without seeing it.
One thing I can recommend is to do all calculations once in the master script.
All script will refer to the master script, so there is no need to perform the same calculations in 2D, 3D and other scripts.
Barry.
2024-05-08 11:05 AM - edited 2024-05-08 11:06 AM
tl;dr You have got everything wrong, but luck prevented that library part from reporting an error. Period.
Long Version,
2024-05-08 03:03 AM
@GDL Enthusiast wrote:
I read in the past about speeding up script by using a _ before a variable to constrain the the GDL reader to only look for a variable within that page. Does this speed up the processing time?
I have not heard of this.
As far as I know, it will not make any difference, and is just a naming convention so you can easily tell in the script that it is a parameter.
The question is, why do you need to state that variable1 = input1 ?
If that is always the case then just use input1.
But if somewhere else in the script variable1 = input2, then that could be a valid thing to do.
As for the efficiency of your script, it is really hard to say without seeing it.
One thing I can recommend is to do all calculations once in the master script.
All script will refer to the master script, so there is no need to perform the same calculations in 2D, 3D and other scripts.
Barry.
2024-05-08 11:05 AM - edited 2024-05-08 11:06 AM
tl;dr You have got everything wrong, but luck prevented that library part from reporting an error. Period.
Long Version,
2024-05-08 11:13 AM
@Nader Belal wrote:
Unless you have hit some of the old (really old) parameters that GDL can get out the program (which I don't believe you have done), then you were quick lucky (see point 3), and even then, those parameters use the tilde as a prefix " ~ "
Do you mean the old GLOBAL variables?
If so, that is the suffix and not the prefix.
And they can be either underscore _ or tilde ~
A_ = GLOB_SCALE
A~ = WALL_FILL
Barry.
2024-05-08 07:37 PM
May be. I was talking out of my memory without consulting the Manual
2024-05-08 10:10 PM
Thank you so much for your response Barry. I am glad I didn't go down the road of using _ to speed up the script and all the work the renaming! Best regards, Matt
2024-05-08 11:34 PM
Hi Nader,
I like the tl;dr, haha it doesn't surprise me 😁
Thank you for all the points, super helpful! I am glad to know the underscore "_" and the double-underscore "__" doesn't keep it local. Saved me a mountian of recoding!
Best regards, Matt
2024-05-09 09:59 AM
Variables can and will be local if they are bounded within a subroutine, unless they were predefined (or initiated) before the definition of a subroutine