Introduction ¶
I’m switching to a new hardware and I’m using a clean SSD. Now, I’m facing the choice of the algorithm for the BTRFS file system. Here is a script that I used to determine which one was the fastest on my specific processor.
Body ¶
I started by searching for an utility to measure the performance of different hash algorithms. Why? Because, no matter how fast an algorithm seems on paper, if it’s not supported by my processor - it will be slow. And how can I know what’s supported by my processor? In the specification online, I didn’t find any information.
I stumbled upon the rhash utility, which has a --speed
key. That’s where I tried to measure performance, but the results of blake2b
and crc32c
were almost identical, which seemed strange to me. In the end, I came up with this script.
|
|
What’s going on here?
- A tmpfs temporary mount point is created on 5 GB (right in the RAM, so it doesn’t depend on SSD/HDD)
- Inside a file of 4 GB is created and then formatted as BTRFS with different hash algorithms
- For each algorithm, two file writing modes are performed:
- One large file of 4 GB
- 1000 files of 4 MB
- At the end, the
time
command outputs the script execution time
On my 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz processor, the best result was shown by the old and good crc32c (~35 seconds), while the others were around ~52 seconds.