-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Speed up sum by using reasonable read buffer sizes. (#3741)
* Speed up sum by using reasonable read buffer sizes. Use a 4K read buffer for each of the checksum functions, which seems reasonable. This improves the performance of BSD checksums on odyssey1024.txt from 399ms to 325ms on my laptop, and of SysV checksums from 242ms to 67ms. * Add BENCHMARKING.md for `sum`. * Add comment regarding block sizes. * Improve portability of BENCHMARKING.md * Make `div_ceil` const and enhance comment.
- Loading branch information
Showing
2 changed files
with
40 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
## Benchmarking `sum` | ||
|
||
<!-- spell-checker:ignore wikidatawiki --> | ||
|
||
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. | ||
|
||
After you have obtained and uncompressed such a file, you need to build `sum` in release mode | ||
|
||
```shell | ||
$ cargo build --release --package uu_sum | ||
``` | ||
|
||
and then you can time how it long it takes to checksum the file by running | ||
|
||
```shell | ||
$ time ./target/release/sum wikidatawiki-20211001-pages-logging.xml | ||
``` | ||
|
||
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 | ||
|
||
```shell | ||
$ hyperfine "./target/release/sum wikidatawiki-20211001-pages-logging.xml" "sum wikidatawiki-20211001-pages-logging.xml" | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters