[OpenSCAD] Programming in Functional OpenSCAD
doug at moens.org
Tue Jan 30 18:16:02 EST 2018
OpenSCAD uses references to reference-counted, immutable values. Multiple
variables can point to the same immutable list object. There is no need for
OpenSCAD to make copies of lists, since there are no operations for
mutating a list. AFAIK; I haven't read all the code in the interpreter.
I don't think there's much point in worrying about this, though. Like
Ronaldo says, just use the simplest possible data structure. If this leads
to a performance problem, and you want to use a more complicated data
structure, you should measure the performance to ensure that the more
complicated code is actually faster. OpenSCAD doesn't have the same
performance characteristics as conventional languages, so your complicated
code might be slower.
On 30 January 2018 at 18:05, NateTG <nate-openscadforum at pedantic.org> wrote:
> > ... For instance, the element insertion and removing from 2-3 trees
> order O(log n). However, an analysis of your implementation in OpenSCAD
> show that its order of complexity is O(n2) or worst due to the repeated
> structure copies required by any change in it. ...
> Does OpenSCAD never use references (so that if there's some variable a,
> b=[a] is going to create a copy of it)?
> Sent from: http://forum.openscad.org/
> OpenSCAD mailing list
> Discuss at lists.openscad.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Discuss