Extreme inefficiency in use/include

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Extreme inefficiency in use/include

RevarBat
I seem to have a catch22:
  • Using “include <file>” for my large (BOSL2) library causes slow animations, as all files get re-included for every single frame.
  • Using “use <file>” instead of “include <file>” is needed to allow module caching to speed up animations.
  • “use <file>" will NOT provide constants/variables to the using parent file, by design.
  • Modules/functions inside a used file cannot see constants/variables from the parent using file.
  • Constants/variables defined (or included) inside a used file will ALL get redeclared/redefined/reassigned on every call into a module/function in that file.  This is EXTREMELY inefficient.

So, in summary:
  • I shouldn't just include all the files, because of poor animation speed.
  • I cannot include constants/variables from one file, then have the functions/modules in a another used file, as the constants/variables won’t be available inside the used file.
  • I cannot have the used file include the constants/variables from another file, due to terrible redeclaration inefficiency.
  • I cannot have the used file declare the constants/variables as they will be unavailable to the using file.
  • I cannot just prune the size of the library down, as individual files in the library, (like beziers.scad) run afoul of the redeclaration bug.

PLEASE fix the “use <file>” variable redeclaration bug.


- Revar


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Extreme inefficiency in use/include

nophead
Yes this has become a huge problem for me as well. Currently my 3D printer design takes 1 minute to evaluate the scad (before it starts GSG product generation), up from about 20 seconds not long ago. As a project grows in complexity the time to process it seems to go up as the square, or perhaps higher power due to it evaluating constants over and over again. The last time I measured it it was hundreds of thousands of times. Perhaps it is millions now.

On Tue, 24 Nov 2020 at 03:43, Revar Desmera <[hidden email]> wrote:
I seem to have a catch22:
  • Using “include <file>” for my large (BOSL2) library causes slow animations, as all files get re-included for every single frame.
  • Using “use <file>” instead of “include <file>” is needed to allow module caching to speed up animations.
  • “use <file>" will NOT provide constants/variables to the using parent file, by design.
  • Modules/functions inside a used file cannot see constants/variables from the parent using file.
  • Constants/variables defined (or included) inside a used file will ALL get redeclared/redefined/reassigned on every call into a module/function in that file.  This is EXTREMELY inefficient.

So, in summary:
  • I shouldn't just include all the files, because of poor animation speed.
  • I cannot include constants/variables from one file, then have the functions/modules in a another used file, as the constants/variables won’t be available inside the used file.
  • I cannot have the used file include the constants/variables from another file, due to terrible redeclaration inefficiency.
  • I cannot have the used file declare the constants/variables as they will be unavailable to the using file.
  • I cannot just prune the size of the library down, as individual files in the library, (like beziers.scad) run afoul of the redeclaration bug.

PLEASE fix the “use <file>” variable redeclaration bug.


- Revar

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
tp3
Reply | Threaded
Open this post in threaded view
|

Re: Extreme inefficiency in use/include

tp3
Indeed, that would be a very useful fix. I just heard about
http://commandermodel.com/393/Volkswagen_Beetle modeled in
OpenSCAD (http://commandermodel.com/beetle.000.jpg). It seems
there are more big (and awesome) projects out there than
widely known which could benefit from that.

ciao,
  Torsten.


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
-- Torsten
Reply | Threaded
Open this post in threaded view
|

Re: Extreme inefficiency in use/include

nophead
It is often said that OpenSCAD's variables are actually named constants but the reality is they are actually only named expressions unless they are in the top level file. When they refer to other expressions and functions it becomes a huge tree that gets evaluated whenever a module or function is called, regardless of whether it is actually used or not.

On Tue, 24 Nov 2020 at 17:32, Torsten Paul <[hidden email]> wrote:
Indeed, that would be a very useful fix. I just heard about
http://commandermodel.com/393/Volkswagen_Beetle modeled in
OpenSCAD (http://commandermodel.com/beetle.000.jpg). It seems
there are more big (and awesome) projects out there than
widely known which could benefit from that.

ciao,
  Torsten.


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org