How to know which code is better?

I wrote this code

Later I realized that the same thing could be done using this other code.

Both return exactly the same result

Now I want to know which one is better.
-Which is faster?
-Which requires fewer resources?
-Which one is more efficient?

Is there any way to know this?

Thank you so much!!

It doesn’t make any difference.

Are you just calculating the distance between two points? Then you could just a ‘distance’ node to do that.

2 Likes

The one that you find easier to read. Don’t underestimate it. Being able to hop in and refactor easily is a major boon.

2 Likes

Hi!!

I am calculating the vertical angle (pitch for my AI).

OK, I will. Thank you very much for your help!!

Ah, sorry, I didn’t read it properly… :grimacing:

It is fine, your answer was useful any way. thx u!! :slight_smile:

1 Like