List Info

Thread: xmlHashCreate and xmlHashAddEntry - hashs of unknown size?




xmlHashCreate and xmlHashAddEntry - hashs of unknown size?
user name
2007-02-02 09:54:51
Suppose I have a hash table who's size I do not know at
compile time - it
might end up with one entry or a thousand.

What value should I pass to xmlHashCreate for the size?

If I pass a value "N", and at run time try to add
"N+1" items to the hash,
will it error or will it just increase the hash size?


_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xmlgnome.org
http://mai
l.gnome.org/mailman/listinfo/xml

Re: xmlHashCreate and xmlHashAddEntry - hashs of unknown size?
user name
2007-02-04 08:15:19
On Fri, Feb 02, 2007 at 09:54:51AM -0600, David Hagood
wrote:
> Suppose I have a hash table who's size I do not know at
compile time - it
> might end up with one entry or a thousand.
> 
> What value should I pass to xmlHashCreate for the
size?
> 
> If I pass a value "N", and at run time try to
add "N+1" items to the hash,
> will it error or will it just increase the hash size?

  Don't worry, go for the lower unless you know it will be
huge.
The algorithm automatically adjusts the hash table size when
it detects
the clash list is growing too long in an entry. The
reajustment takes a
bit of computation though, which you can avoid if you know
it will grow a
lot by giving a large initial value.

Daniel

-- 
Red Hat Virtualization group http://redhat.com/v
irtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillardredhat.com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ |
Rpmfind RPM search engine  http://rpmfind.net/
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xmlgnome.org
http://mai
l.gnome.org/mailman/listinfo/xml

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )