By Wayne Brill
Applies to:
Autodesk Intent Professional 2011
Autodesk® Inventor® Engineer-to-Order Series 2012
Issue
A potentially major performance problem was discovered in Inventor ETO Components 2012 and Intent Professional 2011 Update 3. A serious memory-crash problem involving the List data type discovered late in the release cycle of both products was remedied by making a copy of the list when it is referenced. This was known to be a potential performance problem, especially with large lists, but it resolved the crash issue. Since release, it has become evident that certain coding styles exacerbate the performance problem. For example, consider the following:
Rule myList As List = {1, 2, 3, 4, 5, 6}
Rule slowLoop As List
For index = 1 To Length(myList)
slowLoop = slowLoop + { nth(index, myList) }
Next index
End Rule
In this example, myList is referenced 7 times. This is not an issue if myList is small. But with 1000 elements, it is copied 1001 times, creating more than a million copies of the elements; this is a problem.
Solution
To work around this issue make a single reference to myList in the rule in a local variable, and then use the local variable. This is much faster, and will always be faster, since a local variable reference is faster than a rule reference. So this workaround need not be removed when the original problem is fixed.
Rule fastLoop As List
Dim theList As List = myList
For index = 1 To Length(theList)
fastLoop = fastLoop + { nth(index, theList) }
Next index
End Rule