I think it is faster by storing the node in a variable. I tested it with two function that simply access to a node and change a parameter (the text in a label node). One function use get_node, the other just used a variable. The average times are:
- Function with get_node: 0.000044 seconds = 44 microseconds
- Function without get_node: 0.000005 seconds = 5 microseconds
So by not using get_node we would get 5/44 = 8.8x speedup.
Probably this effect is negligible except in very specific cases, and maybe what @Gokudomatic2 said is more relevant, as other users noted:
And this way, I can change the node name without changing everywhere my code.