Follow-up Comment #2, bug #48169 (project findutils): > Is there are measurable performance difference?
Hard to say. find is now much better at avoiding stat() calls on non-directories, so it's overall faster. Anyway I tracked down where some of these are coming from. First off, the unused F_DUPFD_CLOEXEC comes from ftsfind.c doing curr_fd = dup_cloexec (dir_fd); But curr_fd isn't actually *used* for anything any more, so it could be removed. The duplicate stat comes from fts.c: /* Now read the stat info again after opening a directory to reveal eventual changes caused by a submount triggered by the traversal. But do it only for utilities which use FTS_TIGHT_CYCLE_CHECK. Therefore, only find and du benefit/suffer from this feature for now. */ LEAVE_DIR (sp, cur, "4"); fts_stat (sp, cur, false); so I guess that is necessary for automounts. But maybe it's possible to avoid stat'ing before it's opened? fts.c could use dup_cloexec here: dir_fd = dup (dir_fd); if (0 <= dir_fd) set_cloexec_flag (dir_fd, true); And finally, fts.c's opendirat() could pass O_CLOEXEC to openat() to avoid the set_cloexec_flag() call. _______________________________________________________ Reply to this item at: <http://savannah.gnu.org/bugs/?48169> _______________________________________________ Message sent via/by Savannah http://savannah.gnu.org/