Python Script First Run Has Delay - Rhino 6

I have a lot of scripts set as keyboard shortcuts. Any script has a noticeable delay on first run after Rhino 6 startup. Rhino 5 doesn’t have this issue. All subsequent runs work normal. It must be related to initialization of the interpreter.

Did anyone else notice this or am I nitpicking?

This problem did exist in V5, I haven’t noticed that it got any worse with V6 personally… but YMMV. And yes, it does have to do with the initialization of the interpreter as far as I know. I get that down to a minimum by running the following in my startup commands:

import rhinoscriptsyntax as rs
import scriptcontext as sc
import Rhino

print "Rhino Version V{} - Python loaded!".format(rs.ExeVersion())

That gets the interpreter mostly loaded and ready to go while Rhino is starting, the first script run after that might have a tiny bit of delay still, but I find much less than if I don’t run the above first.

As you still can’t run Python scripts at startup directly, to run this at startup, I created an alias to the script file and then call the alias in the startup command section…


1 Like

I just double checked this since I have both Rhino versions. There is a significant difference in Python init between V5 and V6. Maybe it was already ironed out in V5. Something developers could look into.

Good Tip. Thank you. This annoyed me for a while.