Re: A micro-optimisation for walkdir()

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: A micro-optimisation for walkdir()
Date: 2020-09-02 14:34:58
Message-ID: 316705.1599057298@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thomas Munro <thomas(dot)munro(at)gmail(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2020-09-02 14:36:23 Re: describe-config issue
Previous Message Dilip Kumar 2020-09-02 14:08:49 Re: PATCH: logical_work_mem and logical streaming of large in-progress transactions