freebsd-skq/lib/libc/tests/gen
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
..
execve DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
posix_spawn DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
arc4random_test.c
dir2_test.c Optimize telldir(3) 2017-12-06 22:06:48 +00:00
dlopen_empty_test.c
fmtcheck_test.c
fmtmsg_test.c
fnmatch_test.c
fnmatch_testcases.h fnmatch(3): Update testcase for r322368. 2017-08-10 17:03:46 +00:00
fpclassify2_test.c
ftw_test.c
getmntinfo_test.c getmntinfo(3): Scale faster, and return sooner 2017-08-25 16:38:21 +00:00
glob2_test.c libc glob: Avoid pathological exponential behavior 2017-05-03 15:55:29 +00:00
Makefile Optimize telldir(3) 2017-12-06 22:06:48 +00:00
Makefile.depend DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
popen_test.c
posix_spawn_test.c
realpath2_test.c Add tests for some cases in r318298. 2017-05-18 13:49:53 +00:00
test-fnmatch.c
wordexp_test.c