nudibranchrecords / hedron

Perform live shows with your three.js creations
GNU Affero General Public License v3.0
480 stars 22 forks source link

Improve stategy for updating node values #382

Closed funwithtriangles closed 1 month ago

funwithtriangles commented 4 years ago

Going through the usual redux method for updating nodes is not particularly fast. Actions are dispatched, reducer logic is called, etc, etc.

In a simple world, all we'd need to do is mutate the state wherever we want to update node values. Not only is this a bit ugly but it also doesn't allow us to hook in functionality when nodes update. Currently macros listen to NODE_VALUE_UPDATE and NODE_VALUES_BATCH_UPDATE, so this needs to be handled.

It might make more sense to simply call a function rather than dispatch an action when updating node values. This function could do the state mutation and also do any extras such as the macro handling.

After https://github.com/nudibranchrecords/hedron/pull/381 we've had some fairly nice performance gains so I'm not sure how much this proposed change would improve performance.

funwithtriangles commented 4 years ago

A good test here would be to have a 100 params assigned to one midi control and see what happens.