Skip to content

Commit b911043

Browse files
committed
Added benchmarks
1 parent 6cf84e5 commit b911043

File tree

1 file changed

+44
-1
lines changed

1 file changed

+44
-1
lines changed

proposals/052-cryptography-leg-1.md

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,50 @@ ghci> hashPassword 16 ("Fee fi fo fum!" :: ByteString) :: IO ByteString
120120
(8.84 secs, 2,138,266,840 bytes)
121121
```
122122

123-
It was quick and dirty testing in GHCi so your mileage may vary, but the results indicate that bindings to Botan may be significantly faster and consumes less memory than `crypton/ite`, if other modules / functions are similarly performant. Further implentation, testing, and benchmarking will be necessary to confirm this.
123+
Further testing of `Bcrypt` and `SHA-3` with benchmarking using `tasty-bench` shows a considerable increase in speed, although `Botan` memory usage cannot be accurately measured due to the FFI.
124+
125+
```
126+
$ cabal bench --benchmark-options '+RTS -T' botan-low-bench
127+
Benchmark botan-low-bench: RUNNING...
128+
All
129+
Bcrypt work factor
130+
Crypton
131+
twelve: OK (1.65s)
132+
550 ms ± 27 ms, 109 MB allocated, 30 KB copied, 34 MB peak memory
133+
fourteen: OK (6.57s)
134+
2.198 s ± 29 ms, 492 MB allocated, 21 KB copied, 34 MB peak memory
135+
sixteen: OK (26.38s)
136+
8.797 s ± 34 ms, 2.0 GB allocated, 32 KB copied, 34 MB peak memory
137+
Botan
138+
twelve: OK (1.39s)
139+
232 ms ± 14 ms, 0 B allocated, 0 B copied, 34 MB peak memory
140+
fourteen: OK (1.85s)
141+
925 ms ± 30 ms, 0 B allocated, 0 B copied, 34 MB peak memory
142+
sixteen: OK (11.10s)
143+
3.700 s ± 40 ms, 0 B allocated, 0 B copied, 34 MB peak memory
144+
Hash
145+
Crypton
146+
password: OK (1.17s)
147+
1.10 μs ± 106 ns, 3.0 KB allocated, 0 B copied, 45 MB peak memory
148+
plaintext: OK (1.75s)
149+
1.66 μs ± 109 ns, 3.0 KB allocated, 0 B copied, 45 MB peak memory
150+
longtext: OK (2.31s)
151+
9.04 ms ± 485 μs, 0 B allocated, 0 B copied, 45 MB peak memory
152+
Botan
153+
password: OK (2.30s)
154+
1.09 μs ± 61 ns, 1.1 KB allocated, 93 B copied, 48 MB peak memory
155+
plaintext: OK (1.58s)
156+
1.49 μs ± 119 ns, 1.2 KB allocated, 93 B copied, 49 MB peak memory
157+
longtext: OK (1.42s)
158+
5.55 ms ± 423 μs, 1.0 MB allocated, 117 B copied, 97 MB peak memory
159+
160+
All 12 tests passed (60.66s)
161+
Benchmark botan-low-bench: FINISH
162+
```
163+
164+
Results indicate that bindings to Botan may be significantly more performant than `crypton/ite`, if other modules / functions are similarly performant.
165+
166+
Note that the memory use increase in Hash.Botan.longtext is due to the rough state of initial bindings, as the bindings are not yet leak-free. Despite this, it is still approximately twice as fast.
124167

125168
# Prior Art and Related Efforts
126169

0 commit comments

Comments
 (0)