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:
@@ -782,7 +782,7 @@ class MFProcedureDotExport {
|
||||
void instruction_to_string(const MFCallInstruction &instruction, std::stringstream &ss)
|
||||
{
|
||||
const MultiFunction &fn = instruction.fn();
|
||||
this->instruction_name_format(fn.name() + ": ", ss);
|
||||
this->instruction_name_format(fn.debug_name() + ": ", ss);
|
||||
for (const int param_index : fn.param_indices()) {
|
||||
const MFParamType param_type = fn.param_type(param_index);
|
||||
const MFVariable *variable = instruction.params()[param_index];
|
||||
|
Reference in New Issue
Block a user