On 2022-04-07 20:21, Maxime Devos wrote: > Andrew Tropin schreef op do 07-04-2022 om 20:01 [+0300]: >> Idk how file-exists? works internally, but still expect it to be more >> efficient than lstat.  That's why I decided to use lstat only as a >> "fallback" option in `or` statement. > > Here's the definition, from module/ice-9/boot-9.scm (Guile source > code): > > ;; For reference, Emacs file-exists-p uses stat in this same way. > (define file-exists? > (if (provided? 'posix) > (lambda (str) > (->bool (stat str #f))) > [non-POSIX code that's not relevant to Guix])) > > 'file-exists?' just calls 'stat', a variant of 'lstat', so I don't > think there are performance gains to be had here. Well, the > (stat ... #f) might not need to install an exception handler since it > is written in C, but that seems at most a micro-optimisation to me. > > Greetings, > Maxime. Updated the implementation, which behaves similiar to file-exists?, but not follow symlinks.