1
0
Fork
You've already forked HashBenchmark
0
This project is an attempt to benchmark the speed of some hash algorithms available in Elixir.
  • HTML 99.6%
  • Elixir 0.2%
  • JavaScript 0.1%
2022年11月27日 17:25:01 +01:00
benchmarks/output Add more functions 2022年11月27日 17:25:01 +01:00
lib Add more functions 2022年11月27日 17:25:01 +01:00
test Remove tests 2022年11月27日 16:33:11 +01:00
.formatter.exs First commit 2022年11月27日 16:29:34 +01:00
.gitignore First commit 2022年11月27日 16:29:34 +01:00
LICENSE First commit 2022年11月27日 16:29:34 +01:00
mix.exs First commit 2022年11月27日 16:29:34 +01:00
mix.lock First commit 2022年11月27日 16:29:34 +01:00
README.md Add more functions 2022年11月27日 17:25:01 +01:00

HashBenchmark

This project is an attempt to benchmark the speed of some hash algorithms available in Elixir.

My goal is to find the fastest hash algorithm/implementation in elixir to use it in Etaweb to hash the page contents.

So the main criteria here are fast execution speed and low memory usage.

Installation

  • Install dependencies with mix deps.get
  • Run iex -S mix
  • Use any function available in the HashBenchmark module

Example

The results here are real results I get on my computer. I also get similar results using the benchee_benchmark function.

xxh3 seems to be the fastest of all.

I don't know if the fact that it's an Erlang NIF of a Rust implementation of XXH3 can skew the benchmark results somehow, especially for the memory usage which seems unrealisticly low.

iex> HashBenchmark.timer_benchmark()
[
 {"xxh3 64", 0.0001},
 {"xxh3 128", 0.0001},
 {"crypto.hash sha1", 0.0006},
 {"crypto.hash md5", 0.0014},
 {"murmur x86_32", 0.0274},
 {"murmur x86_128", 0.0297},
 {"murmur x64_128", 0.0637},
 {"xxhash 32", 0.1058},
 {"xxhash 64", 0.1089}
]

Benchee results are available here

Benchee results comparison

License

GNU AFFERO GENERAL PUBLIC LICENSE version 3