Re: A micro-optimisation for walkdir()
Juan José Santamaría Flecha <juanjo.santamaria@gmail.com>
From: Juan José Santamaría Flecha <juanjo.santamaria@gmail.com>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Thomas Munro <thomas.munro@gmail.com>, Tom Lane <tgl@sss.pgh.pa.us>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2020-09-04T20:34:17Z
Lists: pgsql-hackers
On Fri, Sep 4, 2020 at 10:28 PM Alvaro Herrera <alvherre@2ndquadrant.com>
wrote:
> On 2020-Sep-04, Juan José Santamaría Flecha wrote:
>
> > On Fri, Sep 4, 2020 at 9:37 PM Alvaro Herrera <alvherre@2ndquadrant.com>
> > wrote:
> >
> > > On 2020-Sep-04, Thomas Munro wrote:
>
> > > >
> > > > +/* File types for 'd_type'. */
> > > > +enum
> > > > + {
> > > > + DT_UNKNOWN = 0,
> > > > +# define DT_UNKNOWN DT_UNKNOWN
> > >
> > > Uhm ... what do these #defines do? They look a bit funny.
> > >
> > > Would it make sense to give this enum a name, and then use that name in
> > > struct dirent's definition, instead of unsigned char?
> >
> > They mimic POSIX dirent.h. I would rather stick to that.
>
> Ah ... they do?
>
> If you remove the #define lines, what happens to your patch?
>
If will fail to detect that the patch makes the optimisation available for
WIN32:
+#if defined(DT_UNKNOWN) && defined(DT_REG) && defined(DT_DIR) &&
defined(DT_LNK)
Regards,
Juan José Santamaría Flecha
Commits
-
Add d_type to our Windows dirent emulation.
- 87e6ed7c8c6a 14.0 landed
-
Skip unnecessary stat() calls in walkdir().
- 861c6e7c8e4d 14.0 landed