Hello Dynamo Community,
I have a script that flips a spotelevation by getting and setting the type.

Measuring the runtime i get about 500ms, i think there is not much potential to make that faster.
The problem is, that using the script will take about 2 seconds, and this is too long. So is there a delay of about 1-2 seconds for every script? Is there any way to make that faster?
Looking forward to your experience!
kind regards
The script is relatively small, so I doubt you’ll be able to optimise much more other than migrating it to python which should give you some minor gain.
Why is 500ms too slow though? I mean, it’s not much slower than blinking. Also, bear in mind, there will be some hidden overhead costs in revit when changing a family type, revit needs to change the type in its DB and then call for a refresh of the graphics in the view the marker is in, this refresh of graphics, while most likely optimised, will still take time on top of the script execution time. There will also be some time between clicking and dynamo actually executing the code while revit queues up the command to be executed. Also also, if you are running for the first time, there will probably be a little lag as dynamo executes all nodes, however, then next time you will find most of the nodes don’t need to run and data is cached.
2 Likes
Hey Daniel 
Yes 500ms is great, the problem really is all the time that adds to that. So i just wanted to know if there is something that can be done to improve that. But I had not much hope.
I´m sure that no one of my coworks would use a script like this that takes 2 seconds, they will change the type manually and so will i. When clicking on the type in revit it is changed in instant!
I never had a script that had to be that fast, so i just wanted to know what the reasons for the delay are and if something can be done about it. So your answer already was a great benefit 
I really would like to switch to a plugin instead of dynamo player, where i can run the scripts by keyboard shortcuts, this would have a great potential for “micro scripts” like this one, but the delay is a dealbreaker.
Hmm, the thing is your script is so small that you notice these overheads. If you were to flip 1000 tags then I’d bet you this would only take a few seconds too, not 2000 seconds.
Have you tried in dynamo player by any chance? Might find that this could speed it up some, although not sure as I have never benchmarked the player vs dynamo.
Even for a Plugin though, depending on how you have set it up, you might have a small delay while revit handles your request via an external event handler. Actions are queued up and revit decides when to action them… And time to action isn’t always the same, sometimes it’s immediate, other times it’s a tiny delay and could be a few hundred ms.
If a script is so small, that you could do it manually in the same time it takes for the script to run, then I’d say the script might not be worth it! Ha! I mean that in the nicest way though! 
1 Like