This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/28844] hashtable.h initialize reserves a lot of memory, defer until needed



------- Comment #3 from caolanm at redhat dot com  2006-08-25 10:15 -------
Created an attachment (id=12138)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=12138&action=view)
and add some smaller primes to the start of the list

An additional part to this puzzle...

From:   Herbert Duerr <Herbert.Duerr@Sun.COM>
To:     stlport-devel@lists.sourceforge.net

Hash tables have performance characteristics that are an excellent match 
for the scalability requirements of many data structures in real life 
applications.

When examining the memory requirements of an OpenOffice.org startup 
many of the application's hash_maps are considerably oversized. Even providing
proper size hints to the hash table constructor doesn't help, because today's
stlport has a minimum bucket count of 53.

The more general solution is to allow smaller bucket counts by 
prepending the prime list by e.g. 7 and 23. With the default size hint 
of 100 nothing would change for default constructed hash tables. Only 
users who explicitly hint at the high probability of small sized 
containers could notice a change. Since the number of primes in the list 
is still less than the next power of two the binary search would be at 
as fast as before.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28844


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]