]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/commit
MFC r317064: Optimize pathologic case of telldir() for Samba.
authormav <mav@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Mon, 1 May 2017 06:03:44 +0000 (06:03 +0000)
committermav <mav@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Mon, 1 May 2017 06:03:44 +0000 (06:03 +0000)
commit000addc4126754b23251caca882f6d72d41de72e
tree5bf7ebb880fefad85be0e531724c37a3dd957b02
parentc432d7eb8c5f622894436f62b9182596fc80d933
MFC r317064: Optimize pathologic case of telldir() for Samba.

When application reads large directory, calling telldir() for each entry,
like Samba does, it creates exponential performance drop as number of
entries reach tenths to hundreds of thousands.  It is caused by full search
through the internal list, that never finds matches in that scenario, but
creates O(n^2) delays.  This patch optimizes that search, limiting it to
entries of the same buffer, turning time closer to O(n) in case of linear
directory scan.

git-svn-id: svn://svn.freebsd.org/base/stable/10@317634 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
lib/libc/gen/telldir.c