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-25 19:52:55 +0300
committerJacques Lucke <jacques@blender.org>2022-06-25 19:53:26 +0300
commitb513c89e8450289746a7b3397bf3d610a0989d79 (patch)
treed2b930098bcca4bf158356d3783283a85d506dca /source/blender/blenlib
parentba1e97f1c6cd0c614a13eb1b5d7050b7c301d03e (diff)
Functions: avoid using Map for small values
This leads to a 5-10% performance improvement in my benchmark that runs a procedure many times on a single element.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/BLI_cpp_type.hh5
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_cpp_type.hh b/source/blender/blenlib/BLI_cpp_type.hh
index ed680214602..cc48b456da7 100644
--- a/source/blender/blenlib/BLI_cpp_type.hh
+++ b/source/blender/blenlib/BLI_cpp_type.hh
@@ -626,6 +626,11 @@ class CPPType : NonCopyable, NonMovable {
fill_construct_indices_(value, dst, mask);
}
+ bool can_exist_in_buffer(const int64_t buffer_size, const int64_t buffer_alignment) const
+ {
+ return size_ <= buffer_size && alignment_ <= buffer_alignment;
+ }
+
void print(const void *value, std::stringstream &ss) const
{
BLI_assert(this->pointer_can_point_to_instance(value));