diff options
author | Jacques Lucke <jacques@blender.org> | 2022-06-25 19:52:55 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2022-06-25 19:53:26 +0300 |
commit | b513c89e8450289746a7b3397bf3d610a0989d79 (patch) | |
tree | d2b930098bcca4bf158356d3783283a85d506dca /source/blender/blenlib/BLI_cpp_type.hh | |
parent | ba1e97f1c6cd0c614a13eb1b5d7050b7c301d03e (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/BLI_cpp_type.hh')
-rw-r--r-- | source/blender/blenlib/BLI_cpp_type.hh | 5 |
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)); |