diff options
author | Jacques Lucke <jacques@blender.org> | 2020-04-23 12:57:58 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2020-04-23 13:02:06 +0300 |
commit | 614621747ea214efc72a095fbef6695bf98a2bb4 (patch) | |
tree | e8a54ae3373f7e965ecc3d0bf74a44db0a9b077a /source/blender/blenlib/BLI_open_addressing.hh | |
parent | 68cfce1519ed63dc0a231c7de81c26f3f9c810f1 (diff) |
BLI: optimize VectorSet implementation
Instead of building on top of `BLI::Vector`, just use a raw array
and handle the growing in `BLI::VectorSet`.
After this change, the existing `EdgeSet` can be reimplemented using
`BLI::VectorSet` without performance regressions.
Diffstat (limited to 'source/blender/blenlib/BLI_open_addressing.hh')
-rw-r--r-- | source/blender/blenlib/BLI_open_addressing.hh | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/source/blender/blenlib/BLI_open_addressing.hh b/source/blender/blenlib/BLI_open_addressing.hh index fa2ea6d8f94..7b8adcf9bd2 100644 --- a/source/blender/blenlib/BLI_open_addressing.hh +++ b/source/blender/blenlib/BLI_open_addressing.hh @@ -70,7 +70,7 @@ class OpenAddressingArray { /* Can be used to map a hash value into the range of valid slot indices. */ uint32_t m_slot_mask; Allocator m_allocator; - AlignedBuffer<sizeof(Item) * ItemsInSmallStorage, alignof(Item)> m_local_storage; + AlignedBuffer<(uint)sizeof(Item) * ItemsInSmallStorage, (uint)alignof(Item)> m_local_storage; public: explicit OpenAddressingArray(uint8_t item_exponent = 0) @@ -171,6 +171,11 @@ class OpenAddressingArray { return *this; } + Allocator &allocator() + { + return m_allocator; + } + /* Prepare a new array that can hold a minimum of min_usable_slots elements. All entries are * empty. */ OpenAddressingArray init_reserved(uint32_t min_usable_slots) const |