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/intern/multi_function_procedure_executor.cc | |
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/intern/multi_function_procedure_executor.cc')
-rw-r--r-- | source/blender/functions/intern/multi_function_procedure_executor.cc | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/source/blender/functions/intern/multi_function_procedure_executor.cc b/source/blender/functions/intern/multi_function_procedure_executor.cc index 85d0cf4909f..1136b03ed58 100644 --- a/source/blender/functions/intern/multi_function_procedure_executor.cc +++ b/source/blender/functions/intern/multi_function_procedure_executor.cc @@ -20,10 +20,9 @@ namespace blender::fn { -MFProcedureExecutor::MFProcedureExecutor(std::string name, const MFProcedure &procedure) - : procedure_(procedure) +MFProcedureExecutor::MFProcedureExecutor(const MFProcedure &procedure) : procedure_(procedure) { - MFSignatureBuilder signature(std::move(name)); + MFSignatureBuilder signature("Procedure Executor"); for (const ConstMFParameter ¶m : procedure.params()) { signature.add(param.variable->name(), MFParamType(param.type, param.variable->data_type())); |