by rapidlua · 5y ago · 0 comments
The likely culprit is stat - dentry doesn’t have all the attributes inline, so a stat call is needed for EVERY file. That’s a lot of syscalls. Even worse, in a large directory the information won’t be in a cache, so every single stat hits the disk, dominating the time spent.
You're right that the moment you give an option to ls that requires stat calls, though, the stat calls tends to dominate.