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:
@@ -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()));
|
||||
|
Reference in New Issue
Block a user