# Slippery spots of geometry nodes

Correction: Everything that is written in the description of this topic: false understanding of the error. It was found and fixed.

Geometry Nodes are not a programming tutorial. They are not for beginners. It is a programming language that is fast and adapted to the task of procedural modeling. And as in any programming language, if you make a mistake, you fall.
I was making a simple tree generator using matrices to convey branch direction data. And in the process, I noticed very serious drops in performance. I will tell you about an error, which will be very difficult here, where we do not write about what our code details.
You may not understand yet, but the error is:

Just a bunch of vertex multiplication nodes. Their meaning is not important, it is just a test bench. If I run the update, it will be like this:

(Please note the running time is different from the prompt)
And you can put up with it and say that matrices are expensive.
And you can think and ask: why?
Hint: Anything is expensive if done so blindly.
This error is so simple but not intuitive as long as we are no looking at just a bunch of lines.
It seems to us that we have linked memory cells and all data flows from beginning to end in a straight line.
But, these are not threads, these are function CALLS.
If you write the code, then it looks like this:

``````MatrixMultiply(
MatrixMultiply(
MatrixMultiply(
MatrixMultiply(
MatrixMultiply(
//INPUT data for any vertex
)
MatrixMultiply(
//INPUT data for any vertex
)
MatrixMultiply(
//INPUT data for any vertex
)
MatrixMultiply(
//INPUT data for any vertex
)
MatrixMultiply(
//INPUT data for any vertex
)
MatrixMultiply(
//INPUT data for any vertex
)
)...CopyPast
)...CopyPast
)...CopyPast
)...CopyPast
``````

For matrices, input 6 vectors, 5 matrices and 6 vertices, 6 ^ (5 + 1)
This is a recursion of 46656 calls! 46656 *â€¦ vector multiply! FOR JUST CUBE!
And even a novice programmer will fix:

``````M1x = MatrixMultiply(
INPUT data for any vertex
)
M1y = MatrixMultiply(
INPUT data for any vertex
)
M1z = MatrixMultiply(
INPUT data for any vertex
)

M2x = MatrixMultiply(
INPUT data for any vertex
)
M2y = MatrixMultiply(
INPUT data for any vertex
)
M2z = MatrixMultiply(
INPUT data for any vertex
)

MatrixMultiply(
M1x,
M1y,
M1z,
M2x,
M2y,
M2z,
)
``````

That is, just capture the result of the matrix to the geometryâ€¦

Such a pitfall almost made me write a message about an error in the work of the blender, it confused me. You shouldnâ€™t think that the blender will decide this on its own, this is the rule that now needs to be adhered to, this is how the nodes work.

2 Likes

Itâ€™s not entirely clear to me what your message is based on what you wrote. Is it â€śjustâ€ť that something is much slower than you would expect for some reason? If yes, then please share the file so that we can check if there is anything out of ordinary that makes it slow.
Otherwise, I donâ€™t understand the point your are trying to make right now, sorry.

Iâ€™m talking about the fact that now the nodes are at a fairly high level, and if you forget this, then you can make very slow nodes

Well, some nodes are high level and some are more low level. Is there any action you expect from us based on this observation?

This is rather a message for users who can do the same thing, but with a dramatic difference in speed.
https://cdn.discordapp.com/attachments/340195875399663617/918907980240527390/MatrixTimingError.blend
I noticed a problem. I opened the example on an older version and I have no speed problems
3.0 alpha more faster then 3.1 (1:1000~)

I investigated this a bit closer and might have found the issue that you ran into. Please try if it works better after rB7b88a4a3ba7e.

2 Likes

In the example, you have recreated the problem on a massive scale. At first I couldnâ€™t even open it. I am using an old blender (3.0) and had no problem. He also does not have this problem, after changing the file, I was able to open it in 3.1. Returning the connection, he froze and I donâ€™t know how many tens of minutes to wait.
This is the same problem.
Unfortunately, I donâ€™t know how to build it and didnâ€™t find an assembly reference
so I just know what was corrected and that might be the solution.
(I didnâ€™t expect this was not the intended behavior)

You can try a 3.1 build from the buildbot: Blender Builds - blender.org
Note, itâ€™s still recompiling, so you might have to wait 30-60 min. You can follow the progress here: Buildbot.

Yes, the matrix examples work just as well now as your example.
So it was a bug â€¦ and I have already come to terms with this approach and remade the project)
Thank you!