This post errs on the technical side of coding. There's many language related questions that often get asked around, but this post attempts to answer one of them:
"...which is the fastest of them all?"
The idea was initially tossed at me by Shajay Bhooshan and Mostafa El-Sayed at ZHA Co|de: to test the time taken to make 1 million random mesh cubes. We further refined it into 1, 3, 6, 12 and 24 million mesh faces, and we developed 2 ways of doing the same thing. The Spontaneous Array meant that sets of 4 random points and 1face would be computed and added to the mesh immediately, while the Ordered Array would generate all points and store them in an array first, and then append them all in one shot to the mesh and then generate the faces. I tried to be scientific about it, and here's the results:
*all times are best of 4 runs. Note that Rhino4 is 32-bit only.
- In the defense of Rhino 4, may I add that the proceedure that adds geometry to viewport also seems handle the viewport redrawing. So all Rhino 4 solvingTimes add in the time taken to re-draw viewport. This seems to have improved in Rhino 5, where adding geometry to the session and drawing it seem to have been split into seperate proceedures. This was easily noticeable when Grasshopper would become responsive and publish solvingTimes in Rhino 5 while viewports were still being drawn. But in Rhino 4, everything was solved and drawn first, and only then did anything start responding again. Yes Rhino 4 did run out memory and crash twice.
- The ordered and spontaneous arrays don't seem to affect Rhino 5 much, but they seem to affect Rhino 4 where the ordered arrays almost always seem to be faster by about 5%.
- This is not scientific, but on most runs C# seems to achieve its best time on the first run while VB does it in the 2nd or 3rd (almost never the 1st). And C# did seem very slightly marginally faster as array sizes grew.
My home ground is VB.NET. So it is highly likely that code I wrote in VB.NET is very optimized, while in C# a bit less so (less likely because it's nearly a direct translation of VB code) and very poorly written in Python (which is likely because I haven't worked too heavily on Python). It's a Grasshopper 0.80052 definition, and uses Giulio Piacentino's Python component for Grasshopper.
The Grasshopper definition can be downloaded here.
Update: Added in the Maya 2011 times as well, courtesy: Shajay & Mostafa.