<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src/lib/libc/stdlib/hcreate.3, branch releng/14.0</title>
<subtitle>FreeBSD source tree</subtitle>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/'/>
<entry>
<title>Remove $FreeBSD$: two-line nroff pattern</title>
<updated>2023-08-16T17:55:10+00:00</updated>
<author>
<name>Warner Losh</name>
<email>imp@FreeBSD.org</email>
</author>
<published>2023-08-16T17:55:10+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=fa9896e082a1046ff4fbc75fcba4d18d1f2efc19'/>
<id>fa9896e082a1046ff4fbc75fcba4d18d1f2efc19</id>
<content type='text'>
Remove /^\.\\"\n\.\\"\s*\$FreeBSD\$$\n/
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Remove /^\.\\"\n\.\\"\s*\$FreeBSD\$$\n/
</pre>
</div>
</content>
</entry>
<entry>
<title>hcreate(3): fix the ERRORS section and bump .Dd</title>
<updated>2017-02-07T02:32:49+00:00</updated>
<author>
<name>Enji Cooper</name>
<email>ngie@FreeBSD.org</email>
</author>
<published>2017-02-07T02:32:49+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=d5f154d3cfe6e4bb04cc3f0e61edced19b814553'/>
<id>d5f154d3cfe6e4bb04cc3f0e61edced19b814553</id>
<content type='text'>
- Add missing comma between functions that trigger ENOMEM error.
- Fix the description for ESRCH. The action that triggers this error is
  FIND, not SEARCH (SEARCH does not exist).

MFC after:	1 week
Sponsored by:	Dell EMC Isilon
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
- Add missing comma between functions that trigger ENOMEM error.
- Fix the description for ESRCH. The action that triggers this error is
  FIND, not SEARCH (SEARCH does not exist).

MFC after:	1 week
Sponsored by:	Dell EMC Isilon
</pre>
</div>
</content>
</entry>
<entry>
<title>Replace implementation of hsearch() by one that scales.</title>
<updated>2015-12-27T07:50:11+00:00</updated>
<author>
<name>Ed Schouten</name>
<email>ed@FreeBSD.org</email>
</author>
<published>2015-12-27T07:50:11+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=2747eff1280f5cd8d5c375852f5db172ec87dd86'/>
<id>2747eff1280f5cd8d5c375852f5db172ec87dd86</id>
<content type='text'>
Traditionally the hcreate() function creates a hash table that uses
chaining, using a fixed user-provided size. The problem with this
approach is that this often either wastes memory (table too big) or
yields bad performance (table too small). For applications it may not
always be easy to estimate the right hash table size. A fixed number
only increases performance compared to a linked list by a constant
factor.

This problem can be solved easily by dynamically resizing the hash
table. If the size of the hash table is at least doubled, this has no
negative on the running time complexity. If a dynamically sized hash
table is used, we can also switch to using open addressing instead of
chaining, which has the advantage of just using a single allocation for
the entire table, instead of allocating many small objects.

Finally, a problem with the existing implementation is that its
deterministic algorithm for hashing makes it possible to come up with
fixed patterns to trigger an excessive number of collisions. We can
easily solve this by using FNV-1a as a hashing algorithm in combination
with a randomly generated offset basis.

Measurements have shown that this implementation is about 20-25% faster
than the existing implementation (even if the existing implementation is
given an excessive number of buckets). Though it allocates more memory
through malloc() than the old implementation (between 4-8 pointers per
used entry instead of 3), process memory use is similar to the old
implementation as if the estimated size was underestimated by a factor
10. This is due to the fact that malloc() needs to perform less
bookkeeping.

Reviewed by:	jilles, pfg
Obtained from:	https://github.com/NuxiNL/cloudlibc
Differential Revision:	https://reviews.freebsd.org/D4644
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Traditionally the hcreate() function creates a hash table that uses
chaining, using a fixed user-provided size. The problem with this
approach is that this often either wastes memory (table too big) or
yields bad performance (table too small). For applications it may not
always be easy to estimate the right hash table size. A fixed number
only increases performance compared to a linked list by a constant
factor.

This problem can be solved easily by dynamically resizing the hash
table. If the size of the hash table is at least doubled, this has no
negative on the running time complexity. If a dynamically sized hash
table is used, we can also switch to using open addressing instead of
chaining, which has the advantage of just using a single allocation for
the entire table, instead of allocating many small objects.

Finally, a problem with the existing implementation is that its
deterministic algorithm for hashing makes it possible to come up with
fixed patterns to trigger an excessive number of collisions. We can
easily solve this by using FNV-1a as a hashing algorithm in combination
with a randomly generated offset basis.

Measurements have shown that this implementation is about 20-25% faster
than the existing implementation (even if the existing implementation is
given an excessive number of buckets). Though it allocates more memory
through malloc() than the old implementation (between 4-8 pointers per
used entry instead of 3), process memory use is similar to the old
implementation as if the estimated size was underestimated by a factor
10. This is due to the fact that malloc() needs to perform less
bookkeeping.

Reviewed by:	jilles, pfg
Obtained from:	https://github.com/NuxiNL/cloudlibc
Differential Revision:	https://reviews.freebsd.org/D4644
</pre>
</div>
</content>
</entry>
<entry>
<title>Add re-entrant versions of the hash functions based on the GNU api.</title>
<updated>2014-07-21T15:22:48+00:00</updated>
<author>
<name>Pedro F. Giffuni</name>
<email>pfg@FreeBSD.org</email>
</author>
<published>2014-07-21T15:22:48+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=9823a90c79bac3a172a02f7e76947fcbb57e0955'/>
<id>9823a90c79bac3a172a02f7e76947fcbb57e0955</id>
<content type='text'>
While testing this I found a conformance issue in hdestroy()
that will be fixed in a subsequent commit.

Obtained from:	NetBSD (hcreate.c, CVS Rev. 1.7)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
While testing this I found a conformance issue in hdestroy()
that will be fixed in a subsequent commit.

Obtained from:	NetBSD (hcreate.c, CVS Rev. 1.7)
</pre>
</div>
</content>
</entry>
<entry>
<title>mdoc: order prologue macros consistently by Dd/Dt/Os</title>
<updated>2010-04-14T19:08:06+00:00</updated>
<author>
<name>Ulrich Spörlein</name>
<email>uqs@FreeBSD.org</email>
</author>
<published>2010-04-14T19:08:06+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=aa12cea2ccc6e686d6d31cf67d6bc69cbc1ba744'/>
<id>aa12cea2ccc6e686d6d31cf67d6bc69cbc1ba744</id>
<content type='text'>
Although groff_mdoc(7) gives another impression, this is the ordering
most widely used and also required by mdocml/mandoc.

Reviewed by:	ru
Approved by:	philip, ed (mentors)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Although groff_mdoc(7) gives another impression, this is the ordering
most widely used and also required by mdocml/mandoc.

Reviewed by:	ru
Approved by:	philip, ed (mentors)
</pre>
</div>
</content>
</entry>
<entry>
<title>- This code was intially obtained from NetBSD, but it's missing licence</title>
<updated>2008-07-06T17:03:37+00:00</updated>
<author>
<name>Daniel Gerzo</name>
<email>danger@FreeBSD.org</email>
</author>
<published>2008-07-06T17:03:37+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=5fd5badfa9a116a6274479968d6f5d82d0da3fee'/>
<id>5fd5badfa9a116a6274479968d6f5d82d0da3fee</id>
<content type='text'>
  statement. Add the one from the current NetBSD version.
- Also bump a date to reflect my content changes I have done in previous
  revision

Approved by:	imp
MFC after:	3 days
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
  statement. Add the one from the current NetBSD version.
- Also bump a date to reflect my content changes I have done in previous
  revision

Approved by:	imp
MFC after:	3 days
</pre>
</div>
</content>
</entry>
<entry>
<title>- Add description about a missing return value</title>
<updated>2008-07-06T12:17:53+00:00</updated>
<author>
<name>Daniel Gerzo</name>
<email>danger@FreeBSD.org</email>
</author>
<published>2008-07-06T12:17:53+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=6d05da1dc9937ecdf2933b13954a2fae37da77c7'/>
<id>6d05da1dc9937ecdf2933b13954a2fae37da77c7</id>
<content type='text'>
PR:		docs/75995
Submitted by:	Tarc &lt;tarc@po.cs.msu.su&gt;
MFC after:	3 days
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
PR:		docs/75995
Submitted by:	Tarc &lt;tarc@po.cs.msu.su&gt;
MFC after:	3 days
</pre>
</div>
</content>
</entry>
<entry>
<title>Sort sections.</title>
<updated>2005-01-20T09:17:07+00:00</updated>
<author>
<name>Ruslan Ermilov</name>
<email>ru@FreeBSD.org</email>
</author>
<published>2005-01-20T09:17:07+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=24a0682c6465290759ed0b09ea16e40e7cd47053'/>
<id>24a0682c6465290759ed0b09ea16e40e7cd47053</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>mdoc(7): Use the new feature of the .In macro.</title>
<updated>2003-09-08T19:57:22+00:00</updated>
<author>
<name>Ruslan Ermilov</name>
<email>ru@FreeBSD.org</email>
</author>
<published>2003-09-08T19:57:22+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=fe08efe680f6705e0c60beabe3e39629c655e743'/>
<id>fe08efe680f6705e0c60beabe3e39629c655e743</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Document the fact that hdestory calls free on the keys added with</title>
<updated>2003-03-12T14:18:14+00:00</updated>
<author>
<name>David Malone</name>
<email>dwmalone@FreeBSD.org</email>
</author>
<published>2003-03-12T14:18:14+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=5560a5abb3f2c1612e3991c24fbf8bc0deb266ba'/>
<id>5560a5abb3f2c1612e3991c24fbf8bc0deb266ba</id>
<content type='text'>
hsearch(.., ENTER). Make the example reflect this.

PR:		49951
Submitted by:	Peter Jeremy &lt;peterjeremy@optushome.com.au&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
hsearch(.., ENTER). Make the example reflect this.

PR:		49951
Submitted by:	Peter Jeremy &lt;peterjeremy@optushome.com.au&gt;
</pre>
</div>
</content>
</entry>
</feed>
