WIP: Functions: new local allocator for better memory reuse and performance #104630

Draft
Jacques Lucke wants to merge 44 commits from JacquesLucke/blender:local-allocator into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
2 changed files with 4 additions and 1 deletions
Showing only changes of commit 16cd6162fe - Show all commits

View File

@ -268,10 +268,12 @@ class Executor {
BLI_task_pool_free(task_pool);
}
threading::parallel_for(node_states_.index_range(), 1024, [&](const IndexRange range) {
LocalPool<> &local = pools.pools->local();
for (const int node_index : range) {
const Node &node = *self_.graph_.nodes()[node_index];
NodeState &node_state = *node_states_[node_index];
this->destruct_node_state(node, node_state, pools);
Pools sub_pools = {pools.pools, &local};
this->destruct_node_state(node, node_state, sub_pools);
}
});
this->~Executor();

View File

@ -701,6 +701,7 @@ class LazyFunctionForGroupNode : public LazyFunction {
Storage *s = static_cast<Storage *>(storage);
graph_executor_->destruct_storage(s->graph_executor_storage, pools);
std::destroy_at(s);
pools.local->deallocate(storage, sizeof(Storage), alignof(Storage));
}
};