| 1 |
# Benchmarking `sum` |
| 2 |
|
| 3 |
<!-- spell-checker:ignore wikidatawiki --> |
| 4 |
|
| 5 |
Large sample files can for example be found in the [Wikipedia database dumps](https://dumps.wikimedia.org/wikidatawiki/latest/), usually sized at multiple gigabytes and comprising more than 100M lines. |
| 6 |
|
| 7 |
After you have obtained and uncompressed such a file, you need to build `sum` in release mode |
| 8 |
|
| 9 |
```shell |
| 10 |
cargo build --release --package uu_sum |
| 11 |
``` |
| 12 |
|
| 13 |
and then you can time how it long it takes to checksum the file by running |
| 14 |
|
| 15 |
```shell |
| 16 |
time ./target/release/sum wikidatawiki-20251220-pages-logging.xml |
| 17 |
``` |
| 18 |
|
| 19 |
For more systematic measurements that include warm-ups, repetitions and comparisons, [Hyperfine](https://github.com/sharkdp/hyperfine) can be helpful. For example, to compare this implementation to the one provided by your distribution run |
| 20 |
|
| 21 |
```shell |
| 22 |
hyperfine "./target/release/sum wikidatawiki-20251220-pages-logging.xml" "sum wikidatawiki-20251220-pages-logging.xml" |
| 23 |
``` |