[OpenSCAD] Module reuse?

Marius Kintel marius at kintel.net
Thu Oct 20 12:19:11 EDT 2016

> On Oct 19, 2016, at 13:29, nop head <nop.head at gmail.com> wrote:
> If I have a main.scad file that uses a.scad and b.scad and they both use c.scad does OpenSCAD process c.scad twice and keep two separate copies in memory or is one copy of c.scad re-used?

We cache used files but not included files:
In this case we will only parse c.scad once, and cache those results until the timestamp of c.scad or any dependencies of c.scad changes.

> Is it any different if main.scad includes a.scad and b.scad?
In that case, we don’t cache a.scad and b.scad, but c.scad will still be cached as it’s used, not included.

> I ask because every sub assembly file in Mendel90 includes a library of parts and utilities. They also include other sub assemblies which all include all those parts. Would using the parts instead of including them be more efficient?
It will be more efficient as you’d save some time in the parsing step. However, if most of your time is spent doing other stuff than parsing, it unlikely to have a large impact.


More information about the Discuss mailing list