When application reads large directory, calling telldir() for each entry, 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. My patch optimizes that search, limiting it to entries of the same buffer, turning time from O(n^2) closer to O(n) in the case of linear directory scan.
PR: 218622