c++ - unordered_map with forbidden collisions -


i want implement performance-optimized variant of unordered_map works in several phases:

  1. initialization: insert 100 elements std::map
  2. preparation: magic, converting std::map variant of std::unordered_map
  3. work: perform large (unbounded) number of lookups; insertions/deletions forbidden

in order make "work" phase fast possible, choose hashing function has no collisions given set of keys (gathered @ initialization phase).

i measure how performance improvement can trick. going experiment, possibly going production code.

does standard library have facilities implementation (e.g. finding how many collisions given unordered_map has; or changing hashing function)? or should make own implementation instead?

here "collision management" api:

size_type bucket_count() const; size_type max_bucket_count() const;  size_type bucket_size(size_type n) const; size_type bucket(const key_type& k) const;  local_iterator       begin(size_type n); local_iterator       end(size_type n); const_local_iterator begin(size_type n) const; const_local_iterator end(size_type n) const; const_local_iterator cbegin(size_type n) const; const_local_iterator cend(size_type n) const; 

in nutshell, bucket_size(n) gives number of collisions nth bucket. can buckets key, , can iterate on buckets local_iterator.

for changing hash function, assign/construct new container, old hash function new.


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -