Skip to content

Commit afbbb63

Browse files
authored
update syscall comments
1 parent 3111ff6 commit afbbb63

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

posts/maybe-the-fastest-disk-usage-program-on-macos.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ description: "A very fast du -sh clone for macOS."
77

88
I set out to write the fastest `du -sh` clone on macOS and I think I've done it. On a large benchmark, [dumac](https://github.com/healeycodes/dumac) is 6.4x faster than `du` and 2.58x faster than [diskus](https://github.com/sharkdp/diskus) with a warm disk cache.
99

10-
The odds were certainly in my favor as diskus does not use macOS-specific syscalls and instead uses standard POSIX APIs. As I'll go on to explain, I used [tokio tasks](https://docs.rs/tokio/latest/tokio/task/) and [getattrlistbulk](https://man.freebsd.org/cgi/man.cgi?query=getattrlistbulk&sektion=2&manpath=macOS+13.6.5) to be faster than the current crop of `du -sh` clones that run on macOS.
10+
The odds were certainly in my favor as `diskus` does not use macOS-specific syscalls and instead uses standard POSIX APIs. As I'll go on to explain, I used [tokio tasks](https://docs.rs/tokio/latest/tokio/task/) and [getattrlistbulk](https://man.freebsd.org/cgi/man.cgi?query=getattrlistbulk&sektion=2&manpath=macOS+13.6.5) to be faster than the current crop of `du -sh` clones that run on macOS.
1111

1212
## The Challenge
1313

@@ -52,7 +52,7 @@ func handleDir(rootDir string, ch chan int64) {
5252
}
5353
defer dir.Close()
5454

55-
// readdir()
55+
// getdirentries64()
5656
files, err := dir.Readdir(0)
5757
if err != nil {
5858
panic(err)
@@ -67,7 +67,7 @@ func handleDir(rootDir string, ch chan int64) {
6767
size += childSize
6868
} else {
6969

70-
// stat()
70+
// lstat64()
7171
size += file.Sys().(*syscall.Stat_t).Blocks * 512
7272
}
7373
<-sem

0 commit comments

Comments
 (0)