Skip to content

Conversation

@Tessil
Copy link
Owner

@Tessil Tessil commented Jul 31, 2018

Add support for large maps/sets (more than 2^32 - 1 elements) through the IndexType class template parameter. The parameter allows us to configure the index type that is used in bucket_entry.

By default a bucket_entry has a 32 bits integer index to map an element with its position in m_values and a 32 bits hash. Each bucket_entry entry takes thus 8 bytes and the map can only contains 2^32 - 1 elements (-1 due to a reserved value).

Setting the IndexType to a 64 bits integer allows the map to contain more elements but each bucket_entry will take 16 bytes.

tsl::ordered_map<int, int, std::hash<int>, std::equal_to<int>, 
                 std::allocator<std::pair<int, int>>, 
                 std::vector<std::pair<int, int>>, std::uint64_t> map;

@Tessil Tessil merged commit 9642242 into master Jul 31, 2018
@Tessil Tessil deleted the large_maps branch July 31, 2018 19:51
@Tessil Tessil mentioned this pull request Jul 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants