Giter Club home page Giter Club logo

Comments (10)

JacquesLucke avatar JacquesLucke commented on July 19, 2024

every node in all node trees is executed on everyframe..
you cannot 'unconnect' a node tree

You mean that the slowdown happens when you change the node tree or when you playback the animation?

from animation_nodes.

LeonCheung avatar LeonCheung commented on July 19, 2024

I mean when things going like this:

nt

From the trees I've tested, it happens when changing on node setup at least. About the playback speed, I didn't get a very complex setup to test so far.

from animation_nodes.

JacquesLucke avatar JacquesLucke commented on July 19, 2024

Hm okay.
Can you estimate the total amount of nodes?

I have some ideas how to speed up those things but I don't know if it helps much when you have so many node trees

I can check that tomorrow

from animation_nodes.

LeonCheung avatar LeonCheung commented on July 19, 2024

Sure, I'll try. Btw, I tested with my timer_v3.blend file so far. When playing back the default scene, it's about 27 fps, which went down to 11 after simply duplicating the node tree for 100 times then changing some link or adding some new node (It also happens even when the Text Ouput node is removed bedore duplicating).

However, after toggling off the Scene Update checkbox, it works fine as before. So, I bet this is kinda trick, or, things have to be working like that?


EDIT:
The Scene Update toggle only speed up the playback fps. Operations on node setups, such as linking / unlinking / adding / removting nodes, switching nodes operations (switching from math operations list for example), become relatively slow. (chaning values and toggles are fine, however)

from animation_nodes.

JacquesLucke avatar JacquesLucke commented on July 19, 2024

ah now I know exactly what you are talking about :)
(duplicating 100 times is a lot, I hope nobody will ever have such a huge node setup :D )

I will try to explain whats going on in the background. maybe I will write a small documentation about that later.

The execution progress is separated into two parts:

  • build python scripts from the animation node trees and compile these
  • execute the compiled python scripts

The first part runs everytime you change the node tree (linking, adding, etc + when a node says that the python scripts should be updated (as the math node does))
https://github.com/JacquesLucke/animation-nodes/blob/master/nodes/number/mn_float_math.py#L19

The generation of the python scripts is one of the core parts I wrote for this addon.
Everything for this happens here: https://github.com/JacquesLucke/animation-nodes/blob/master/mn_network_code_generator.py
this is also the place where I will speed up this process

To see the generated python scripts you have to open the console (Window ->Toogle System Console) and click on Print Node Tree Code in the developer panel.

You can see there that the selected math operation changes the script, because it is very optimised with the so called in-line-execution where a node writes code instead of executing the operation in the execute function.

Whenever you change the frame or a property or the scene updates (yes, these are the 3 checkboxes) this script is executed.

The reason why I separated this progress is because I think that the playback speed is much more important than time it takes when you change the node tree.

the scene updates around 30 times per second (I didn't count that). So when you playback your animation the script is executed on every frame change ( 25 fps) + these scene updates.
It may be a good idea to not execute the script when the scene updates while you playback the animation. Will see if that works.

I hope that was understandable and maybe you found that even interesting :)

btw: you can also print the time it takes to execute all generated python scripts by checking Print Update Time in the developer panel.
The average execution time of your timer is 0.00015 s -> 6700 fps
There is no other way I can think of to have such a fast execution time, although this is only a python script and not C-code or so

from animation_nodes.

LeonCheung avatar LeonCheung commented on July 19, 2024

Yeah, I know 100 trees would be hardly possible practically, just want to make things more clear by extremity. :P

And thank you so much for such a comprehensive explanation! Now I get it more than before. :)

from animation_nodes.

JacquesLucke avatar JacquesLucke commented on July 19, 2024

haha yes. I tested you extrem example myself now :)

I just started searching where the slow parts are

from animation_nodes.

JacquesLucke avatar JacquesLucke commented on July 19, 2024

399dae8
so small things -.- with such a huge impact on the performance

from animation_nodes.

LeonCheung avatar LeonCheung commented on July 19, 2024

Yeah, it seems faster indeed! 👍

from animation_nodes.

JacquesLucke avatar JacquesLucke commented on July 19, 2024

reroute nodes dramatically decrease the performance...

this is the speedup of the last 45 min: 0.6578s -> 0.1399s

from animation_nodes.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.