-
- Downloads
BLI: new C++ hash table data structures
This commit adds some new hashing based data structures to blenlib. All of them use open addressing with probing currently. Furthermore, they support small object optimization, but it is not customizable yet. I'll add support for this when necessary. The following main data structures are included: **Set** A collection of values, where every value must exist at most once. This is similar to a Python `set`. **SetVector** A combination of a Set and a Vector. It supports fast search for elements and maintains insertion order when there are no deletes. All elements are stored in a continuous array. So they can be iterated over using a normal `ArrayRef`. **Map** A set of key-value-pairs, where every key must exist at most once. This is similar to a Python `dict`. **StringMap** A special map for the case when the keys are strings. This case is fairly common and allows for some optimizations. Most importantly, many unnecessary allocations can be avoided by storing strings in a single buffer. Furthermore, the interface of this class uses `StringRef` to avoid unnecessary conversions. This commit is a continuation of rB369d5e8ad2bb7.
Showing
- .clang-format 1 addition, 0 deletions.clang-format
- source/blender/blenlib/BLI_hash_cxx.h 100 additions, 0 deletionssource/blender/blenlib/BLI_hash_cxx.h
- source/blender/blenlib/BLI_map.h 596 additions, 0 deletionssource/blender/blenlib/BLI_map.h
- source/blender/blenlib/BLI_math_base.h 2 additions, 0 deletionssource/blender/blenlib/BLI_math_base.h
- source/blender/blenlib/BLI_open_addressing.h 302 additions, 0 deletionssource/blender/blenlib/BLI_open_addressing.h
- source/blender/blenlib/BLI_set.h 470 additions, 0 deletionssource/blender/blenlib/BLI_set.h
- source/blender/blenlib/BLI_set_vector.h 366 additions, 0 deletionssource/blender/blenlib/BLI_set_vector.h
- source/blender/blenlib/BLI_string_map.h 410 additions, 0 deletionssource/blender/blenlib/BLI_string_map.h
- source/blender/blenlib/CMakeLists.txt 6 additions, 0 deletionssource/blender/blenlib/CMakeLists.txt
- source/blender/blenlib/intern/math_base_inline.c 15 additions, 0 deletionssource/blender/blenlib/intern/math_base_inline.c
- tests/gtests/blenlib/BLI_map_test.cc 243 additions, 0 deletionstests/gtests/blenlib/BLI_map_test.cc
- tests/gtests/blenlib/BLI_math_base_test.cc 30 additions, 0 deletionstests/gtests/blenlib/BLI_math_base_test.cc
- tests/gtests/blenlib/BLI_set_test.cc 189 additions, 0 deletionstests/gtests/blenlib/BLI_set_test.cc
- tests/gtests/blenlib/BLI_set_vector_test.cc 102 additions, 0 deletionstests/gtests/blenlib/BLI_set_vector_test.cc
- tests/gtests/blenlib/BLI_string_map_test.cc 201 additions, 0 deletionstests/gtests/blenlib/BLI_string_map_test.cc
- tests/gtests/blenlib/CMakeLists.txt 4 additions, 0 deletionstests/gtests/blenlib/CMakeLists.txt
Loading
Please register or sign in to comment