This repository has been archived on 2023-10-09. You can view files and clone it, but cannot push or open issues or pull requests.
Files
blender-archive/source/blender/functions/intern/multi_function_params.cc
Jacques Lucke 72cc68e299 Functions: only allocate resource scope when it is actually used
In most cases it is currently not used, so always having it there
causes unnecessary overhead. In my test file that causes
a 2 % performance improvement.
2023-01-14 15:56:43 +01:00

21 lines
760 B
C++

/* SPDX-License-Identifier: GPL-2.0-or-later */
#include "FN_multi_function_params.hh"
namespace blender::fn::multi_function {
void ParamsBuilder::add_unused_output_for_unsupporting_function(const CPPType &type)
{
ResourceScope &scope = this->resource_scope();
void *buffer = scope.linear_allocator().allocate(type.size() * min_array_size_,
type.alignment());
const GMutableSpan span{type, buffer, min_array_size_};
actual_params_.append_unchecked_as(std::in_place_type<GMutableSpan>, span);
if (!type.is_trivially_destructible()) {
scope.add_destruct_call(
[&type, buffer, mask = mask_]() { type.destruct_indices(buffer, mask); });
}
}
} // namespace blender::fn::multi_function