On Thu, Dec 21, 2023 at 9:32 PM Kaz Kylheku via Cygwin <cygwin@cygwin.com> wrote: > On 2023-12-21 04:16, Martin Wege via Cygwin wrote: > > On Wed, Dec 20, 2023 at 6:21 PM Kaz Kylheku via Cygwin > > <cygwin@cygwin.com> wrote: [snip] > > The root cause is IMO the extra Win32 syscalls (>= 3 per file lookup, > > compared to 1 on Linux) to lookup the *.lnk and *.exe.lnk files on > > filesystems which have native link support (NTFS, ReFS, SMBFS, NFS). > > On SMBFS and NFS it hurts the most, because access latency is the > > highest for networked filesystems. > > Could some intelligent caching be added there? (Discussion of > associated invalidation problem in 3... 2.... 1... )
See below, basically a short-lived cache which is only valid for the lifetime of the one POSIX function call would be OK... > Can you discuss more details, so people don't have to dive into code > to understand it? If we are accessing some file "foo", the application > or user may actually be referring to a "foo.lnk" link. But in the > happy case that "foo" exists, why would we bother looking for "foo.lnk"? > > If "foo" does not exist, but "foo.lnk" does, that could probably be > cached, so that next time "foo" is accessed, we go straight for "foo.lnk", > and keep using that while it exists. > > If someone has both "foo" and "foo.lnk" in the same directory, > that's a bit of a degenerate case; how important is it to be "correct", > anyway. Question, mainly for Corinna: Could the code be modified to use one |NtQueryDirectoryFile()| call with a SINGLE pattern testing for { "foo", "foo.lnk", "foo.lnk.exe", ... } (instead of calling the kernel for each suffix independently) and cache that information for the lifetime of the matching POSIX function call ? The idea is to reduce the number of userland<--->kernel roundstrips from <n> to <1>, and filesystem drivers could be optimized even further (for example if the network filesystem protocol supports file name globbing...) ---- Bye, Roland -- __ . . __ (o.\ \/ /.o) roland.ma...@nrubsig.org \__\/\/__/ MPEG specialist, C&&JAVA&&Sun&&Unix programmer /O /==\ O\ TEL +49 641 3992797 (;O/ \/ \O;) -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple