I have some minor insights to share on the coding-end of the DC design. I hesitate to share them because they are quite unscientific indeed, but useful as they may get others thinking about the code structure of DCs, for which I havenât seen any documents (correct me if Iâm wrong) about efficient code within the DC. If someone knows of a resource like this any help is much appreciated.
I set up the following test using 12" cubes as the base component:
A container component to make copies in the X-direction of this initial cube, based on cube copies=parent!LenX/LenX
A container component for that to make copies in the Y-direction, based on similar copies=parent!LenY/LenY
A final container for Z, direction, same approach.
So I have a set of nested components, based on the initial cube. The first one makes a line of cubes, the next one makes columns of these lines of cubes, the last makes stacks of these layers. Pretty simple, right?
Things get bogged down when you get to about a 20x20x20 stack of cubes. Perfect. Just what Iâm looking for - some real lag time that I can measure and make sense of - something measured in seconds or minutes, not milliseconds. Something I can time on my iPhone while it works.
So I time it, and the test I did was to take a 20x20x3 stack, put in a construction line @ 20 out, hit the scale tool and just when I clicked, hit the start on the stopwatch. Took about 1:05 to complete the operation.
Next I thought, OK what if I have the main component calculate how many copies to make in each direction based on LenX/Y/Z, then pass that down through the sub components. That way, each sub-component wonât have to do its own calculation - it can just reference the variable passed to it. Seems like it should save time, right? So I created xCopies, yCopies, zCopies and created corresponding hooks in the sub-components referencing zCopies=parent!zCopies, etc.
Stretching this box again gave me a second test. This operation took about 1:35 to turn into the 20x20x20 cube.
So from this very, very basic and cursory view, I canât say that the results produced anything of statistical significance. I was hoping that the component with the pre-calculated values would preform better, but maybe the calcs are so simple that it doesnât matter. Simple division is quick, and maybe easier for the computer to do than passing variables down the line over and over. Maybe the calculation time doesnât even factor into the component creation, and itâs the geometry creation itself that is what the processor wrestles with the most.