logoalt Hacker News

tasty_freezeyesterday at 3:39 PM2 repliesview on HN

That is a fun exercise, but I imagine the time to evaluate the conditional expression is a tiny fraction, just a percent or less, than the time it takes to make the file system calls.


Replies

nasretdinovyesterday at 5:13 PM

For many cases you don't even need to make stat() call to determine whether or not the file is a directory (d_type specifically can tell it: https://man7.org/linux/man-pages/man3/readdir.3.html). That's what allows find(1) to be so quick

show 1 reply
CerryuDuyesterday at 4:34 PM

... not to mention the time it takes to load directory entries and inodes when the cache is cold.