From: "Todd C. Miller" Subject: Re: optimise reading the file index To: Christian Weisgerber Cc: gameoftrees@openbsd.org Date: Thu, 27 Jul 2023 09:07:13 -0600 On Thu, 27 Jul 2023 15:19:47 +0200, Christian Weisgerber wrote: > The current code uses fread(3), i.e., buffered stdio, which translates > to a long series of 16 kB read(2) system calls. stdio uses the "optimal" buffer size reported for the device, st_blksize from struct stat. The buffer size can be modified via a call to setvbuf(). The defaults were created when memory was more dear so you may be able to improve things by just bumping the buffer size. > For a got status of /usr/src, 786 read(2) calls look rather negligible > compared to 92,300+ stat(2) calls. Yikes, that is a lot. - todd