]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
MFC r317064: Optimize pathologic case of telldir() for Samba.
authormav <mav@FreeBSD.org>
Mon, 1 May 2017 06:03:07 +0000 (06:03 +0000)
committermav <mav@FreeBSD.org>
Mon, 1 May 2017 06:03:07 +0000 (06:03 +0000)
commita94f79fae55276f08e1d17550c5c518aee500604
tree9f10f21bc1425e3dc7af5fc24dadf29da485db4f
parentf0bd9b16be9a08f7efde72adaa5de8a67048dc72
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.
lib/libc/gen/telldir.c