diff options
author | Jacques Lucke <jacques@blender.org> | 2021-03-22 13:57:24 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2021-03-22 14:01:07 +0300 |
commit | 01b6c4b32bf0aa3f2add0d4d51de9f777cf5c51c (patch) | |
tree | 38ea49ab0bfd0cf2ad1b8979819cac658b3db2d1 /source/blender/functions/FN_multi_function_network_evaluation.hh | |
parent | ccb372d17c2db88141dc4511550daac024121eb9 (diff) |
Functions: make multi functions smaller and cheaper to construct in many cases
Previously, the signature of a `MultiFunction` was always embedded into the function.
There are two issues with that. First, `MFSignature` is relatively large, because it contains
multiple strings and vectors. Secondly, constructing it can add overhead that should not
be necessary, because often the same signature can be reused.
The solution is to only keep a pointer to a signature in `MultiFunction` that is set during
construction. Child classes are responsible for making sure that the signature lives
long enough. In most cases, the signature is either embedded into the child class or
it is allocated statically (and is only created once).
Diffstat (limited to 'source/blender/functions/FN_multi_function_network_evaluation.hh')
-rw-r--r-- | source/blender/functions/FN_multi_function_network_evaluation.hh | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/source/blender/functions/FN_multi_function_network_evaluation.hh b/source/blender/functions/FN_multi_function_network_evaluation.hh index 2c0d94615b0..17cffa406f7 100644 --- a/source/blender/functions/FN_multi_function_network_evaluation.hh +++ b/source/blender/functions/FN_multi_function_network_evaluation.hh @@ -28,6 +28,7 @@ class MFNetworkEvaluationStorage; class MFNetworkEvaluator : public MultiFunction { private: + MFSignature signature_; Vector<const MFOutputSocket *> inputs_; Vector<const MFInputSocket *> outputs_; |