freebsd-nq/lib/libc/tests
Alan Somers 82241ed55c Optimize telldir(3)
Currently each call to telldir() requires a malloc and adds an entry to a
linked list which must be traversed on future telldir(), seekdir(),
closedir(), and readdir() calls. Applications that call telldir() for every
directory entry incur O(n^2) behavior in readdir() and O(n) in telldir() and
closedir().

This optimization eliminates the malloc() and linked list in most cases by
packing the relevant information into a single long. On 64-bit architectures
msdosfs, NFS, tmpfs, UFS, and ZFS can all use the packed representation.  On
32-bit architectures msdosfs, NFS, and UFS can use the packed
representation, but ZFS and tmpfs can only use it for about the first 128
files per directory.  Memory savings is about 50 bytes per telldir(3) call.
Speedup for telldir()-heavy directory traversals is about 20-30x for one
million files per directory.

Reviewed by:	kib, mav, mckusick
MFC after:	3 weeks
Sponsored by:	Spectra Logic Corp
Differential Revision:	https://reviews.freebsd.org/D13385
2017-12-06 22:06:48 +00:00
..
c063 DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
db DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
gen Optimize telldir(3) 2017-12-06 22:06:48 +00:00
hash DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
iconv DIRDEPS_BUILD: Connect new directories. 2017-10-31 00:04:07 +00:00
inet DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
locale DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
net DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
nss DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
regex DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
resolv DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
rpc DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
setjmp DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
ssp DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
stdio DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
stdlib DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
string DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
sys DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
termios DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
time DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
tls DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
tls_dso DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
ttyio DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
Makefile Only build lib/libc/tests/iconv if MK_ICONV != no 2016-10-21 04:54:43 +00:00
Makefile.depend DIRDEPS_BUILD: Connect MK_TESTS. 2016-03-09 22:46:01 +00:00
Makefile.netbsd-tests Change WARNS to 2 across the board with all the libc testcases 2015-11-15 05:21:58 +00:00