Closed c02y closed 3 years ago
Thanks a lot for letting me know. This is new to me, and I will see if I can reproduce this despite being on very different hardware by now that does have different performance characteristics.
If so, that should be an easy fix.
Looking at the history there doesn't seem to be an obvious candidate for a regression, but nothing that a bisect can't find.
Here is what I am getting:
hyperfine './dua-2.10.7 /Applications/*' './dua-2.11.0 /Applications/*'
Benchmark #1: ./dua-2.10.7 /Applications/*
Time (mean ± σ): 1.068 s ± 0.201 s [User: 749.0 ms, System: 4022.0 ms]
Range (min … max): 0.998 s … 1.641 s 10 runs
Warning: The first benchmarking run for this command was significantly slower than the rest (1.641 s). This could be caused by (filesystem) caches that were not filled until after the first run. You should consider using the '--warmup' option to fill those caches before the actual benchmark. Alternatively, use the '--prepare' option to clear the caches before each timing run.
Benchmark #2: ./dua-2.11.0 /Applications/*
Time (mean ± σ): 1.060 s ± 0.149 s [User: 747.6 ms, System: 4040.9 ms]
Range (min … max): 1.001 s … 1.483 s 10 runs
Warning: The first benchmarking run for this command was significantly slower than the rest (1.483 s). This could be caused by (filesystem) caches that were not filled until after the first run. You should consider using the '--warmup' option to fill those caches before the actual benchmark. Alternatively, use the '--prepare' option to clear the caches before each timing run.
Summary
'./dua-2.11.0 /Applications/*' ran
1.01 ± 0.24 times faster than './dua-2.10.7 /Applications/*'
Thus for now the issue can't be reproduced, at least when running on MacOS. I did update dependencies before running the latest version, but that doesn't have any effect on performance.
Maybe you can run a git bisect
with hyperfine
to pinpoint the issue.
It is weird, v2.10.7 installed from Manjaro repo is much faster than the same version binary downloaded from github release page:
$ hyperfine "./dua-v2.10.7-x86_64-unknown-linux-musl/dua /*" "./dua-v2.11.0-x86_64-unknown-linux-musl/dua /*" "dua /*" -i
Benchmark #1: ./dua-v2.10.7-x86_64-unknown-linux-musl/dua /*
Time (mean ± σ): 3.471 s ± 0.049 s [User: 24.428 s, System: 19.024 s]
Range (min … max): 3.394 s … 3.525 s 10 runs
Warning: Ignoring non-zero exit code.
Benchmark #2: ./dua-v2.11.0-x86_64-unknown-linux-musl/dua /*
Time (mean ± σ): 3.264 s ± 0.045 s [User: 22.855 s, System: 17.679 s]
Range (min … max): 3.180 s … 3.316 s 10 runs
Warning: Ignoring non-zero exit code.
Benchmark #3: dua /*
Time (mean ± σ): 897.7 ms ± 37.9 ms [User: 2.696 s, System: 8.462 s]
Range (min … max): 848.1 ms … 961.5 ms 10 runs
Warning: Ignoring non-zero exit code.
Summary
'dua /*' ran
3.64 ± 0.16 times faster than './dua-v2.11.0-x86_64-unknown-linux-musl/dua /*'
3.87 ± 0.17 times faster than './dua-v2.10.7-x86_64-unknown-linux-musl/dua /*'
It's odd indeed, maybe the one in Manjaro is built with processor specific optimisations enabled, whereas the one on GitHub is generic assuming no particular processor type/features.
However, dua
is clearly bound by syscalls and not by user space CPU, so that shouldn't be much of a difference.
Maybe try to compile it on your machine to get more samples. If it's slow(er), it's probably something done by the packagers.
Sorry about one thing, I might use the wrong dua
from my PATH when I said it was installed from Manjaro repo, since I found dua binaries both in my /bin/
and ~/.cargo/bin
(~/.cargo/bin/dua
is used first), and I installed and uninstalled dua-cli package from Manjaro repo multiple times, I don't know which dua
was used when I did the test, so I post the data again with more details:
>> hyperfine "/bin/dua /*" "~/.cargo/bin/dua /*" "~/dua-v2.11.0-x86_64-unknown-linux-musl/dua /*" -i
Benchmark #1: /bin/dua /*
Time (mean ± σ): 886.4 ms ± 33.8 ms [User: 2.703 s, System: 8.390 s]
Range (min … max): 853.6 ms … 951.4 ms 10 runs
Warning: Ignoring non-zero exit code.
Benchmark #2: ~/.cargo/bin/dua /*
Time (mean ± σ): 893.5 ms ± 19.4 ms [User: 2.693 s, System: 8.534 s]
Range (min … max): 862.7 ms … 919.4 ms 10 runs
Warning: Ignoring non-zero exit code.
Benchmark #3: ~/dua-v2.11.0-x86_64-unknown-linux-musl/dua /*
Time (mean ± σ): 3.920 s ± 0.062 s [User: 26.043 s, System: 21.297 s]
Range (min … max): 3.850 s … 4.008 s 10 runs
Warning: Ignoring non-zero exit code.
Summary
'/bin/dua /*' ran
1.01 ± 0.04 times faster than '~/.cargo/bin/dua /*'
4.42 ± 0.18 times faster than '~/dua-v2.11.0-x86_64-unknown-linux-musl/dua /*'
>> /bin/dua v2.10.7
>> ~/.cargo/bin/dua --version
dua 2.11.0
>> file /bin/dua ~/.cargo/bin/dua ~/dua-v2.11.0-x86_64-unknown-linux-musl/dua
/bin/dua: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=1b866af359e74f05b94b43356052b37779ea508c, for GNU/Linux 3.2.0, stripped
/home/chz/.cargo/bin/dua: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=3f0a23a1481aedb2fffb5deb1ba41d3273b54d92, for GNU/Linux 3.2.0, with debug_info, not stripped
/home/chz/dua-v2.11.0-x86_64-unknown-linux-musl/dua: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, stripped
I'll just use the cargo version then.
I don't understand the full details of the differences of file
command of the three binaries though.
I installed v2.10.7 from Manjaro repo since it is the latest version from Manjaro testing branch v2.11.0 is just released so I tested it and notice it takes much more time than the v2.10.7
I also tested v2.11.0 and v2.10.10:
Don't know if you notice this issue