Re: A micro-optimisation for walkdir()

From: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: Andres Freund <andres(at)anarazel(dot)de>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Subject: Re: A micro-optimisation for walkdir()
Date: 2020-09-05 18:58:51
Message-ID: CAEudQAo7Pj=zrvaOKs=K05xR=Od9A6x-ru-SYa8qPoJxY3tXuw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Juan,

This is only a suggestion, if you find it appropriate.
We could use a little cut tail in get_dirent_type function.

Try to avoid add padding, when modifying or adding fields.
struct dirent
{
long d_ino;
unsigned short d_reclen;
unsigned short d_namlen;
+ unsigned char d_type;
char d_name[MAX_PATH];
};

Or even better if possible:
struct dirent
{
char d_name[MAX_PATH];
long d_ino;
unsigned short d_reclen;
unsigned short d_namlen;
unsigned char d_type;
};

regards,
Ranier Vilela

Attachment Content-Type Size
v4-0001-Skip-unnecessary-stat-calls-in-walkdir.patch application/octet-stream 9.2 KB
v4-0002-Add-d_type-to-WIN32-dirent-port.patch application/octet-stream 1.6 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2020-09-05 19:03:43 Re: logtape.c stats don't account for unused "prefetched" block numbers
Previous Message Tom Lane 2020-09-05 18:18:29 Re: Dubious code in pg_rewind's process_target_file()