Out of interest I took the same code I used in this post and with the required changes for using in VSTA, ran the macro against the same project in the previous post. Here are the results:
R2010 iterator creation time 111ms
R2010 Total elements : 2319, wall count : 1754, door count : 404, in 16774ms
R2010 iterator creation time 92ms
R2010 Total elements : 2319, wall count : 1754, door count : 404, in 15061ms
R2010 iterator creation time 95ms
R2010 Total elements : 2319, wall count : 1754, door count : 404, in 14736ms
R2010 iterator creation time 92ms
R2010 Total elements : 2319, wall count : 1754, door count : 404, in 15250ms
R2010 iterator creation time 96ms
R2010 Total elements : 2319, wall count : 1754, door count : 404, in 15272ms
As we can see a macro version of the Filter test runs about 12x slower than the standard API test. I’m guessing, but this is probably due to the marshalling across AppDomains. And not getting faster with subsequent runs is probably due to the macro system using a new instance of the assembly every time the macro is run.
So in conclusion, Filters in macros perform fairly well. But if you find your macros are too slow for your liking convert them to a standard Revit API command for a good jump in performance.
FYI, I haven’t forgotten about the user settings series… Posts coming.