From 615be919f38cd3c94f8926baa82102985ff2b7dd Mon Sep 17 00:00:00 2001 From: Stas Boukarev Date: Wed, 4 Jun 2014 16:28:26 +0400 Subject: [PATCH] Optimize PROBE-FILE. In QUERY-FILE-SYSTEM, avoid formatting an error message if no error is requested. FORMAT is not expanded during the build, making it even slower. --- src/code/filesys.lisp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/code/filesys.lisp b/src/code/filesys.lisp index a8bf4ec5c..5df2f54ad 100644 --- a/src/code/filesys.lisp +++ b/src/code/filesys.lisp @@ -294,10 +294,12 @@ :format-control "~@" :format-arguments (list query-for pathname pathspec))) - (flet ((fail (note-format pathname errno) - (if errorp - (simple-file-perror note-format pathname errno) - (return-from query-file-system nil)))) + (macrolet ((fail (note-format pathname errno) + ;; Do this as a macro to avoid evaluating format + ;; calls when ERROP is NIL + `(if errorp + (simple-file-perror ,note-format ,pathname ,errno) + (return-from query-file-system nil)))) (let ((filename (native-namestring pathname :as-file t))) #!+win32 (case query-for