On 01/24/2013 09:28 AM, Eli Zaretskii wrote: > Is it really worth our while to spend energy on speeding up an API > that goes mostly unused in Emacs? Its only heavy user is ls-lisp.el, This patch also improves the performance of file-name-completion -- perhaps you missed that part? Anyway, on the POSIX side it's a pretty simple patch to Emacs proper and is an obvious performance win, and it'd be a shame if it couldn't be put in. > I suggest to use in dired.c functions that will accept both a > file name and a file descriptor, Better than that, w32 can model the POSIX file descriptor by using an int that represents the directory name. The attached patch does that. It's a bit of a hack, but I don't see why it wouldn't work. If it doesn't work, we can fall back on doing things the Gnulib way. Gnulib uses 'int' to emulate "open" directories on MS-Windows, and this works for many other GNU applications. It's probably cleaner to do it that way in the long run, so this patch has a FIXME or two about this. In this patch, the MS-Windows port shouldn't need to worry about the added source files; it should be able to ignore them all. For example, it needn't worry about lib/dirent.in.h. I haven't tested it on MS-Windows, though.