There is a nice advice in MAXScript FAQ: Cache frequently used functions and objects but it doesn't work for me (at all). Why? Script example: (16000 iteration in for loop) startTime = timeStamp() firstSelectedBaseobject = selection[1].baseobject edgesBetweenMatIDs = #() edgesNumber = polyOp.getNumEdges…
Normally caching the function works really well. But you're correct it has no effect on this particular function. I took a pass on the script it went from 1.08 seconds to 0.04 seconds. The basic ideas to make things faster (with MaxScript) are avoid using memory in loops, and avoid converting data types especially in…