nsStringKey/ and differences between plhash and pldhash

Benjamin Smedberg <[email protected]> Fri, 15 Nov 2002 02:05:20 -0500
Newsgroups gmane.comp.mozilla.devel.nspr,gmane.comp.mozilla.devel.xpcom
Organization Another Netscape Collabra Server User
Message-ID <[email protected]>
What are the functional differences between nspr/lib/ds/plhash.h and 
xpcom/ds/pldhash.h.  Is pldhash.h newer and more-efficient than plhash.h?

I have been completing a template-based hashtable for C++ objects based 
on plhash.h, because I found it first (similar to nsObjectHashtable, but 
automatically threadsafe).  I have mostly gotten the code working... 
would it be worthwhile to think about recoding using pldhash.h instead?

I also see bug 119745, regarding nsStringKey. how often is nsStringKey 
actually used? Would it make sense to optimize nsStringKey to use shared 
buffers a la nsSharableString, to reduce memory usage?  If there are 
many nsStringKey objects floating around, I would think you could obtain 
a sizable memory reduction, and reduce fragmentation on the heap.  I 
just filed http://bugzilla.mozilla.org/show_bug.cgi?id=180264 on that issue.