Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2022-06-19 15:25:21 +0300
committerJacques Lucke <jacques@blender.org>2022-06-19 15:25:56 +0300
commitd48735cca2c69cefa7d4cdf3128cfdcd1beeb909 (patch)
tree38918f8b4403c1068029e3ffd884c1a74940a2f4 /source/blender/functions/FN_multi_function_procedure.hh
parent575884b827864141a25e55b3989b4b1f5bcc72a3 (diff)
Functions: speedup multi-function procedure executor
This improves performance of the procedure executor on secondary metrics (i.e. not for the main use case when many elements are processed together, but for the use case when a single element is processed at a time). In my benchmark I'm measuring a 50-60% improvement: * Procedure with a single function (executed many times): `5.8s -> 2.7s`. * Procedure with 1000 functions (executed many times): `2.4 -> 1.0s`. The speedup is mainly achieved in multiple ways: * Store an `Array` of variable states, instead of a map. The array is indexed with indices stored in each variable. This also avoids separately allocating variable states. * Move less data around in the scheduler and use a `Stack` instead of `Map`. `Map` was used before because it allows for some optimizations that might be more important in the future, but they don't matter right now (e.g. joining execution paths that diverged earlier). * Avoid memory allocations by giving the `LinearAllocator` some memory from the stack.
Diffstat (limited to 'source/blender/functions/FN_multi_function_procedure.hh')
-rw-r--r--source/blender/functions/FN_multi_function_procedure.hh8
1 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/functions/FN_multi_function_procedure.hh b/source/blender/functions/FN_multi_function_procedure.hh
index 75a54992a48..da269b08155 100644
--- a/source/blender/functions/FN_multi_function_procedure.hh
+++ b/source/blender/functions/FN_multi_function_procedure.hh
@@ -87,7 +87,7 @@ class MFVariable : NonCopyable, NonMovable {
MFDataType data_type_;
Vector<MFInstruction *> users_;
std::string name_;
- int id_;
+ int index_in_graph_;
friend MFProcedure;
friend MFCallInstruction;
@@ -101,7 +101,7 @@ class MFVariable : NonCopyable, NonMovable {
StringRefNull name() const;
void set_name(std::string name);
- int id() const;
+ int index_in_procedure() const;
};
/** Base class for all instruction types. */
@@ -376,9 +376,9 @@ inline StringRefNull MFVariable::name() const
return name_;
}
-inline int MFVariable::id() const
+inline int MFVariable::index_in_procedure() const
{
- return id_;
+ return index_in_graph_;
}
/** \} */