From: Christian Weisgerber Subject: Re: optimise reading the file index To: gameoftrees@openbsd.org Date: Thu, 27 Jul 2023 15:19:47 +0200 Stefan Sperling: > mmap is probably faster than the current code only because with mmap we are > asking the kernel to read page-sized blocks from the file, instead of tiny > amounts like sizeof(uint32_t), sizeof(uint64_t) sized-chunks. (Not sure what > the minimun size of a read in the kernel is, probably a 512 bytes sector? > Could be less than a page.) The current code uses fread(3), i.e., buffered stdio, which translates to a long series of 16 kB read(2) system calls. For a got status of /usr/src, 786 read(2) calls look rather negligible compared to 92,300+ stat(2) calls. -- Christian "naddy" Weisgerber naddy@mips.inka.de