Dynamo nodes vs Code Block; who is faster?


#1

during RTC EUR a question arised.

what is faster, a set of standard Dynamo nodes or the same functions defined using Code Blocks.

 

 

1st the code defined in Dynamo standard nodes:
code for time2then the same solution in Code Blocks:

code for time 1the timer is a python script:

time_pythonthe result:

time passed 2Dynamo:

time passed 1and Code Blocks.

 

 

 

 


#2

Hello Peter Kompolschek,

Nice comparison.

Thanks,

Ritesh


#3

How does this compare with doing the same thing within a Python node?


#4

This is pretty cool!


#5

Hi Peter!

This is really cool. Thanks for initiating this conversation. My question now is for the Dynamo team: Why is it that Code blocks execute faster than set of standard nodes?

Thank you,


#6

Konrad,

This is just my guess, but it should have something to do with the fact that if you open a .dyn file with a text editor, you’ll see that each node balloon is represented by a unique id, contents and 2D coordinates. So when you have a complex chain of code balloons, every time you run your definition, dynamo has to act like a miniature database and an assembler in the background, has to figure out what content is connected to what, sort it and combine it and then finally execute the code.

While in comparison when all the code is in the same code block, you can go straight to the execution part.