Skip to content

Commit e6ecb1f

Browse files
committed
Update benchmark results
Signed-off-by: Anjan Roy <[email protected]>
1 parent 76b1ef4 commit e6ecb1f

4 files changed

+1548
-4542
lines changed

README.md

+54-30
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Few of those places, where I've already used `sha3` as ( git submodule based ) d
1919
> [!WARNING]
2020
> Above list may not be up-to-date !
2121
22-
Here I'm maintaining a zero-dependency, header-only C++ library, using modern C++ features ( such as C++{>=11} ), which is fairly easy-to-use in your project, implementing SHA3 [specification](https://dx.doi.org/10.6028/NIST.FIPS.202) i.e. NIST FIPS PUB 202.
22+
Here I'm maintaining a zero-dependency, header-only C++ library, using modern C++ features ( such as C++{>=11} ), which is fairly easy-to-use in your project, implementing SHA3 [specification](https://dx.doi.org/10.6028/NIST.FIPS.202) i.e. NIST FIPS PUB 202.
2323

2424
> [!NOTE]
2525
> All Sha3 hash functions and xofs are implemented as `constexpr` functions - meaning for any statically defined input message these functions can be evaluated in compile-time in constant-expression context. See [tests](./tests).
@@ -35,6 +35,39 @@ SHA3-512 | N ( >=0 ) -bytes message | 64 -bytes digest | Given N -bytes input me
3535
SHAKE-128 | N ( >=0 ) -bytes message | M ( >=0 ) -bytes output | Given N -bytes input message, this routine squeezes arbitrary ( = M ) number of output bytes from Keccak[256] sponge, which has already *(incrementally)* absorbed input bytes. | [`shake128::shake128_t`](./include/sha3/shake128.hpp)
3636
SHAKE-256 | N ( >=0 ) -bytes message | M ( >=0 ) -bytes digest | Given N -bytes input message, this routine squeezes arbitrary ( = M ) number of output bytes from Keccak[512] sponge, which has already *(incrementally)* absorbed input bytes. | [`shake256::shake256_t`](./include/sha3/shake256.hpp)
3737

38+
Performance of SHA3 hash and extendable output functions on a `12th Gen Intel(R) Core(TM) i7-1260P`, running `Linux 6.11.0-18-generic` kernel, compiled with `GCC-14.2.0` with optimization options `-O3 -march=native -flto`.
39+
40+
**SHA3 Hash Functions**
41+
42+
| Algorithm | Input Size (bytes) | MB/s (Median) |
43+
|--------------|--------------------|---------------|
44+
| SHA3-256 | 64 | 483 |
45+
| SHA3-256 | 256 | 700 |
46+
| SHA3-256 | 1024 | 644 |
47+
| SHA3-256 | 4096 | 642 |
48+
| SHA3-256 | 16384 | 655 |
49+
| SHA3-512 | 64 | 602 |
50+
| SHA3-512 | 256 | 367 |
51+
| SHA3-512 | 1024 | 330 |
52+
| SHA3-512 | 4096 | 335 |
53+
| SHA3-512 | 16384 | 339 |
54+
55+
**SHA3 Extendable Output Functions**
56+
57+
| Algorithm | Input Size (bytes) | Output Size (bytes) | MB/s (Median) |
58+
|--------------|--------------------|----------------------|--------------|
59+
| SHAKE128 | 64 | 64 | 465 |
60+
| SHAKE128 | 256 | 64 | 698 |
61+
| SHAKE128 | 1024 | 64 | 663 |
62+
| SHAKE128 | 4096 | 64 | 706 |
63+
| SHAKE128 | 16384 | 64 | 717 |
64+
| - | - | - | - |
65+
| SHAKE256 | 64 | 64 | 464 |
66+
| SHAKE256 | 256 | 64 | 699 |
67+
| SHAKE256 | 1024 | 64 | 672 |
68+
| SHAKE256 | 4096 | 64 | 638 |
69+
| SHAKE256 | 16384 | 64 | 642 |
70+
3871
## Prerequisites
3972

4073
- A C++ compiler such as `g++`/ `clang++`, with support for C++20 standard library.
@@ -94,24 +127,24 @@ CXX=clang++ make test -j
94127

95128
```bash
96129
PASSED TESTS (18/18):
97-
3 ms: build/test/test.out Sha3Xof.CompileTimeEvalShake256
130+
1 ms: build/test/test.out Sha3Hashing.CompileTimeEvalSha3_384
131+
1 ms: build/test/test.out Sha3Xof.CompileTimeEvalShake256
132+
1 ms: build/test/test.out Sha3Hashing.CompileTimeEvalSha3_512
133+
2 ms: build/test/test.out Sha3Hashing.CompileTimeEvalSha3_256
134+
2 ms: build/test/test.out Sha3Hashing.CompileTimeEvalSha3_224
98135
4 ms: build/test/test.out Sha3Xof.CompileTimeEvalShake128
99-
12 ms: build/test/test.out Sha3Hashing.CompileTimeEvalSha3_224
100-
13 ms: build/test/test.out Sha3Hashing.CompileTimeEvalSha3_256
101-
13 ms: build/test/test.out Sha3Hashing.CompileTimeEvalSha3_512
102-
16 ms: build/test/test.out Sha3Hashing.CompileTimeEvalSha3_384
103-
18 ms: build/test/test.out Sha3Hashing.Sha3_224IncrementalAbsorption
104-
18 ms: build/test/test.out Sha3Hashing.Sha3_256IncrementalAbsorption
105-
19 ms: build/test/test.out Sha3Hashing.Sha3_384IncrementalAbsorption
106-
19 ms: build/test/test.out Sha3Hashing.Sha3_512IncrementalAbsorption
107-
21 ms: build/test/test.out Sha3Hashing.Sha3_384KnownAnswerTests
108-
21 ms: build/test/test.out Sha3Hashing.Sha3_224KnownAnswerTests
109-
21 ms: build/test/test.out Sha3Xof.Shake128KnownAnswerTests
110-
21 ms: build/test/test.out Sha3Hashing.Sha3_256KnownAnswerTests
111-
22 ms: build/test/test.out Sha3Hashing.Sha3_512KnownAnswerTests
112-
22 ms: build/test/test.out Sha3Xof.Shake256KnownAnswerTests
113-
1078 ms: build/test/test.out Sha3Xof.Shake128IncrementalAbsorptionAndSqueezing
114-
1159 ms: build/test/test.out Sha3Xof.Shake256IncrementalAbsorptionAndSqueezing
136+
5 ms: build/test/test.out Sha3Hashing.Sha3_256KnownAnswerTests
137+
6 ms: build/test/test.out Sha3Hashing.Sha3_224IncrementalAbsorption
138+
7 ms: build/test/test.out Sha3Hashing.Sha3_512KnownAnswerTests
139+
7 ms: build/test/test.out Sha3Xof.Shake128KnownAnswerTests
140+
7 ms: build/test/test.out Sha3Hashing.Sha3_224KnownAnswerTests
141+
7 ms: build/test/test.out Sha3Hashing.Sha3_512IncrementalAbsorption
142+
7 ms: build/test/test.out Sha3Hashing.Sha3_256IncrementalAbsorption
143+
7 ms: build/test/test.out Sha3Hashing.Sha3_384KnownAnswerTests
144+
8 ms: build/test/test.out Sha3Xof.Shake256KnownAnswerTests
145+
8 ms: build/test/test.out Sha3Hashing.Sha3_384IncrementalAbsorption
146+
1028 ms: build/test/test.out Sha3Xof.Shake128IncrementalAbsorptionAndSqueezing
147+
1112 ms: build/test/test.out Sha3Xof.Shake256IncrementalAbsorptionAndSqueezing
115148
```
116149

117150
## Benchmarking
@@ -131,24 +164,15 @@ make benchmark -j # Else you have to issue this one.
131164

132165
### On 12th Gen Intel(R) Core(TM) i7-1260P
133166

134-
Compiled with `g++ (Ubuntu 14.2.0-4ubuntu2) 14.2.0` while running on `Linux 6.11.0-9-generic x86_64`.
167+
Compiled with `g++ (Ubuntu 14.2.0-4ubuntu2) 14.2.0` while running on `Linux 6.11.0-18-generic x86_64`.
135168

136-
I maintain benchmark results in JSON format @ [bench_result_on_Linux_6.11.0-9-generic_x86_64_with_g++_14](./bench_result_on_Linux_6.11.0-9-generic_x86_64_with_g++_14.json).
169+
I maintain benchmark results in JSON format @ [bench_result_on_Linux_6.11.0-18-generic_x86_64_with_g++_14](./bench_result_on_Linux_6.11.0-18-generic_x86_64_with_g++_14.json).
137170

138171
### On Apple M1 Max
139172

140173
Compiled with `Apple Clang version 16.0.0` while running kernel `Darwin 24.1.0 arm64`.
141174

142-
Maintaining benchmark results in JSON format @ [bench_result_on_Darwin_24.1.0_arm64_with_c++_16.0.0](./bench_result_on_Darwin_24.1.0_arm64_with_c++_16.0.0.json).
143-
144-
### On AWS EC2 Instance `c8g.medium` i.e. ARM Neoverse-V2
145-
146-
Compiled with `g++ (Ubuntu 13.2.0-23ubuntu4) 13.2.0 ` while running on `Linux 6.8.0-1016-aws aarch64`.
147-
148-
I maintain benchmark results in JSON format @ [bench_result_on_Linux_6.8.0-1016-aws_aarch64_with_g++_13](./bench_result_on_Linux_6.8.0-1016-aws_aarch64_with_g++_13.json).
149-
150-
> [!NOTE]
151-
> More about AWS EC2 instances @ https://aws.amazon.com/ec2/instance-types/c8g.
175+
Maintaining benchmark results in JSON format @ [bench_result_on_Darwin_24.3.0_arm64_with_c++_16.0.0](./bench_result_on_Darwin_24.3.0_arm64_with_c++_16.0.0.json).
152176

153177
## Usage
154178

0 commit comments

Comments
 (0)