Skip to content
Nelson Vides edited this page Mar 5, 2021 · 2 revisions

Some comparisons between this fast_pbkdf2, the two more downloaded implementations of pbkdf2 for both erlang and elixir in hex, respectively, and custom pbkdf2 code as was last had in MongooseIM before using fast_pbkdf2. All are run with sha256, and passwords and salt generated with base64:encode(crypto:strong_rand_bytes(16)).

With input 10000 iterations

Name ips average deviation median 99th %
fast_pbkdf2 135.49 7.38 ms ±6.26% 7.34 ms 7.77 ms
pbkdf2_elixir 18.74 53.38 ms ±3.39% 53.16 ms 56.91 ms
pbkdf2 erlang 17.46 57.26 ms ±17.27% 59.60 ms 71.71 ms
pbkdf2_erlang 7.17 139.38 ms ±1.06% 139.24 ms 147.39 ms

Comparison:

fast_pbkdf2 135.49
pbkdf2_elixir 18.74 - 7.23x slower +45.99 ms
pbkdf2 erlang 17.46 - 7.76x slower +49.88 ms
pbkdf2_erlang 7.17 - 22.92x slower +133.30 ms

Memory usage statistics:

Name Memory usage
fast_pbkdf2 0.00007 MB
pbkdf2_elixir 1.36 MB - 19877.56x memory usage +1.36 MB
pbkdf2 erlang 2.90 MB - 42206.56x memory usage +2.90 MB
pbkdf2_erlang 3.20 MB - 46671.44x memory usage +3.20 MB

With input 1M iterations

Name ips average deviation median 99th %
fast_pbkdf2 1.35 0.74 s ±0.44% 0.74 s 0.75 s
pbkdf2_elixir 0.187 5.35 s ±0.75% 5.35 s 5.45 s
pbkdf2 erlang 0.154 6.50 s ±2.22% 6.49 s 6.79 s
pbkdf2_erlang 0.0731 13.68 s ±0.65% 13.65 s 13.85 s

Comparison:

fast_pbkdf2 1.35
pbkdf2_elixir 0.187 - 7.22x slower +4.61 s
pbkdf2 erlang 0.154 - 8.77x slower +5.76 s
pbkdf2_erlang 0.0731 - 20.89x slower +13.03 s

Memory usage statistics:

Name Memory usage
fast_pbkdf2 0.00007 MB
pbkdf2_elixir 136.41 MB - 1986638.89x memory usage +136.41 MB
pbkdf2 erlang 289.92 MB - 4222197.89x memory usage +289.92 MB
pbkdf2_erlang 320.43 MB - 4666671.44x memory usage +320.43 MB
Clone this wiki locally