Dynamo nodes vs Code Block; who is faster?

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.

 

 

 

 

3 Likes

Hello Peter Kompolschek,

Nice comparison.

Thanks,

Ritesh

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

This is pretty cool!

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,

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.