[gcc 4.5 patch] Permit smaller hash tables for hash_map and hash_set

Ian Lance Taylor iant@google.com
Fri Feb 6 23:31:00 GMT 2009


Do we have a general policy for patches to hash_map and hash_set, now
that they have moved to include/backward?

I have a few patches to make them better in some circumstances.  These
ideas are incorporated in different from in the newer unordered_set and
unordered_map.  However, existing code still uses hash_map and hash_set,
so it may be useful to update them if we think that is OK.

Anyhow, this patch permits hash_{map,set} to be smaller.  This is useful
because not every hash table is large.  In unordered_{map,set} we permit
the number of buckets to start at 2.  This patch simply adds the number
5 at the start of the list of bucket counts for hash_{map,set}, so that
at least they don't have to start with 53 buckets.

Is this patch OK for gcc 4.5?

Ian


2009-02-06  Ian Lance Taylor  <iant@google.com>

	* include/backward/hashtable.h (_S_num_primes): Change to 29.
	(__stl_prime_list): Add 5 at the start of the list.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: foo.patch
Type: text/x-patch
Size: 1318 bytes
Desc: Permit smaller hash tables
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20090206/fb8a4e33/attachment.bin>


More information about the Gcc-patches mailing list