Re: A micro-optimisation for walkdir() - Mailing list pgsql-hackers

From Tom Lane
Subject Re: A micro-optimisation for walkdir()
Date
Msg-id 316705.1599057298@sss.pgh.pa.us
Whole thread Raw
In response to A micro-optimisation for walkdir()  (Thomas Munro <thomas.munro@gmail.com>)
Responses Re: A micro-optimisation for walkdir()  (Juan José Santamaría Flecha <juanjo.santamaria@gmail.com>)
List pgsql-hackers
Thomas Munro <thomas.munro@gmail.com> writes:
> You don't need to call stat() just to find out if a dirent is a file
> or directory, most of the time.  Please see attached.

Hm.  If we do this, I can see wanting to apply the knowledge in more
places than walkdir().  Is it possible to extract out the nonstandard
bits into a reusable subroutine?  I'm envisioning an API more or less
like

   extern enum PGFileType identify_file_type(const char *path,
                                             const struct dirent *de,
                                             bool look_thru_symlinks);

            regards, tom lane



pgsql-hackers by date:

Previous
From: Dilip Kumar
Date:
Subject: Re: PATCH: logical_work_mem and logical streaming of large in-progress transactions
Next
From: Tom Lane
Date:
Subject: Re: describe-config issue