We value your input!
Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey

GDL
About building parametric objects with GDL.
SOLVED!

Efficiency of Script for speed

GDL Enthusiast
Enthusiast

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

2 ACCEPTED SOLUTIONS

Accepted Solutions
Solution
Barry Kelly
Moderator

@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.

 

One of the forum moderators.
Versions 6.5 to 27
i7-10700 @ 2.9Ghz, 32GB ram, GeForce RTX 2060 (6GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11

View solution in original post

Solution
Nader Belal
Mentor

tl;dr You have got everything wrong, but luck prevented that library part from reporting an error. Period.

 

Long Version,

  1. Learn the difference between Parameters and Variable, both are the same, but their scope is different.
  2. The underscore "_" and the double-underscore "__" is a styling convention for GDL script, where the underscore "_" prefix is to indicate that this is a variable, and the double-underscore "__" prefix is a variable within a subroutine. Also return to point 1.
  3. Speed issue. You simple have got so lucky to get the results that you have got. Usually these changes cause the GDL Editor to throw errors because the script would not work.
  4. 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 " ~ "
A good friend of mine have once told me that I´m so brute that I´m capable of creating a GDL script capable of creating GDLs.

View solution in original post

7 REPLIES 7
Solution
Barry Kelly
Moderator

@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.

 

One of the forum moderators.
Versions 6.5 to 27
i7-10700 @ 2.9Ghz, 32GB ram, GeForce RTX 2060 (6GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11
Solution
Nader Belal
Mentor

tl;dr You have got everything wrong, but luck prevented that library part from reporting an error. Period.

 

Long Version,

  1. Learn the difference between Parameters and Variable, both are the same, but their scope is different.
  2. The underscore "_" and the double-underscore "__" is a styling convention for GDL script, where the underscore "_" prefix is to indicate that this is a variable, and the double-underscore "__" prefix is a variable within a subroutine. Also return to point 1.
  3. Speed issue. You simple have got so lucky to get the results that you have got. Usually these changes cause the GDL Editor to throw errors because the script would not work.
  4. 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 " ~ "
A good friend of mine have once told me that I´m so brute that I´m capable of creating a GDL script capable of creating GDLs.

@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.

One of the forum moderators.
Versions 6.5 to 27
i7-10700 @ 2.9Ghz, 32GB ram, GeForce RTX 2060 (6GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11

May be. I was talking out of my memory without consulting the Manual

A good friend of mine have once told me that I´m so brute that I´m capable of creating a GDL script capable of creating GDLs.

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

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

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

A good friend of mine have once told me that I´m so brute that I´m capable of creating a GDL script capable of creating GDLs.