diff options
author | Jacques Lucke <jacques@blender.org> | 2021-11-21 14:37:04 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2021-11-21 14:48:07 +0300 |
commit | 6ee2abde82ef121cd6e927995053ac33afdbb438 (patch) | |
tree | f2ed1bb0962c0ea60c30ba7d9dea2a6e184ec247 /source/blender/functions/FN_multi_function.hh | |
parent | d455eadcd82f2151e858025cae6788b65016811e (diff) |
Functions: use static names for multi-functions
Previously, the function names were stored in `std::string` and were often
created dynamically (especially when the function just output a constant).
This resulted in a lot of overhead.
Now the function name is just a `const char *` that should be statically
allocated. This is good enough for the majority of cases. If a multi-function
needs a more dynamic name, it can override the `MultiFunction::debug_name`
method.
In my test file with >400,000 simple math nodes, the execution time improves from
3s to 1s.
Diffstat (limited to 'source/blender/functions/FN_multi_function.hh')
-rw-r--r-- | source/blender/functions/FN_multi_function.hh | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/source/blender/functions/FN_multi_function.hh b/source/blender/functions/FN_multi_function.hh index c57f6cf574e..3059fe59ca7 100644 --- a/source/blender/functions/FN_multi_function.hh +++ b/source/blender/functions/FN_multi_function.hh @@ -97,6 +97,8 @@ class MultiFunction { return signature_ref_->function_name; } + virtual std::string debug_name() const; + bool depends_on_context() const { return signature_ref_->depends_on_context; |