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.
This commit is contained in:
2021-11-21 12:37:04 +01:00
parent d455eadcd8
commit 6ee2abde82
13 changed files with 74 additions and 83 deletions

View File

@@ -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 &param : procedure.params()) {
signature.add(param.variable->name(), MFParamType(param.type, param.variable->data_type()));