-
Notifications
You must be signed in to change notification settings - Fork 0
Benchmark
Peter edited this page Feb 4, 2020
·
10 revisions
// BenchmarkDotNet=v0.7.5.0
// OS=Microsoft Windows NT 6.2.9200.0
// Processor=AMD Ryzen 7 3700X 8-Core Processor, ProcessorCount=16
// CLR=MS.NET 4.0.30319.42000, Arch=64-bit [RyuJIT]
Encryption speed: 131,944186454618 MB/s, 2,4252679 seconds/total. 320 MB/total
Decryption speed: 133,17244991613 MB/s, 2,4028994 seconds/total. 320 MB/total
Encryption speed: 129,470431947347 MB/s, 2,4716068 seconds/total. 320 MB/total
Decryption speed: 133,398353914337 MB/s, 2,3988302 seconds/total. 320 MB/total
// Pre-Warmup: 1 op, 9684.9 ms, 9684872800 ns, 96848728 ticks, 9684872800 ns/op, 0.1 op/s
// Warmup (idle): 1 op, 0 ms, 600 ns, 6 ticks, 600 ns/op, 1666666.7 op/s
// IterationCount = 1
// Target (idle): 1 op, 0 ms, 100 ns, 1 ticks, 100 ns/op, 10000000 op/s
// Target (idle): 1 op, 0 ms, 100 ns, 1 ticks, 100 ns/op, 10000000 op/s
// Target (idle): 1 op, 0 ms, 100 ns, 1 ticks, 100 ns/op, 10000000 op/s
// Target (idle): 1 op, 0 ms, 100 ns, 1 ticks, 100 ns/op, 10000000 op/s
// Target (idle): 1 op, 0 ms, 100 ns, 1 ticks, 100 ns/op, 10000000 op/s
Encryption speed: 132,395197513155 MB/s, 2,4170061 seconds/total. 320 MB/total
Decryption speed: 133,602575924465 MB/s, 2,3951634 seconds/total. 320 MB/total
// Warmup 1: 1 op, 9641.7 ms, 9641672300 ns, 96416723 ticks, 9641672300 ns/op, 0.1 op/s
Encryption speed: 132,530913871058 MB/s, 2,414531 seconds/total. 320 MB/total
Decryption speed: 133,865039693285 MB/s, 2,3904673 seconds/total. 320 MB/total
Target 1: 1 op, 9620.2 ms, 9620178100 ns, 96201781 ticks, 9620178100 ns/op, 0.1 op/s
Encryption speed: 132,512879837818 MB/s, 2,4148596 seconds/total. 320 MB/total
Decryption speed: 133,682897399671 MB/s, 2,3937243 seconds/total. 320 MB/total
Target 2: 1 op, 9624.3 ms, 9624346400 ns, 96243464 ticks, 9624346400 ns/op, 0.1 op/s
Encryption speed: 132,508095002341 MB/s, 2,4149468 seconds/total. 320 MB/total
Decryption speed: 133,346601320165 MB/s, 2,3997612 seconds/total. 320 MB/total
Target 3: 1 op, 9633.6 ms, 9633639400 ns, 96336394 ticks, 9633639400 ns/op, 0.1 op/s
Encryption speed: 132,515157145791 MB/s, 2,4148181 seconds/total. 320 MB/total
Decryption speed: 133,652969979914 MB/s, 2,3942603 seconds/total. 320 MB/total
Target 4: 1 op, 9639.5 ms, 9639496000 ns, 96394960 ticks, 9639496000 ns/op, 0.1 op/s
Encryption speed: 132,546910422644 MB/s, 2,4142396 seconds/total. 320 MB/total
Decryption speed: 133,683947336044 MB/s, 2,3937055 seconds/total. 320 MB/total
Target 5: 1 op, 9633.2 ms, 9633172300 ns, 96331723 ticks, 9633172300 ns/op, 0.1 op/s
Encryption speed: 132,227246903517 MB/s, 2,4200761 seconds/total. 320 MB/total
Decryption speed: 133,232104690457 MB/s, 2,4018235 seconds/total. 320 MB/total
Target 6: 1 op, 9655.5 ms, 9655488200 ns, 96554882 ticks, 9655488200 ns/op, 0.1 op/s
Encryption speed: 132,580546514414 MB/s, 2,4136271 seconds/total. 320 MB/total
Decryption speed: 133,85449581278 MB/s, 2,3906556 seconds/total. 320 MB/total
Target 7: 1 op, 9622 ms, 9621998400 ns, 96219984 ticks, 9621998400 ns/op, 0.1 op/s
Encryption speed: 132,231552489749 MB/s, 2,4199973 seconds/total. 320 MB/total
Decryption speed: 133,265811988592 MB/s, 2,401216 seconds/total. 320 MB/total
Target 8: 1 op, 9654.9 ms, 9654931700 ns, 96549317 ticks, 9654931700 ns/op, 0.1 op/s
Encryption speed: 132,222881500201 MB/s, 2,420156 seconds/total. 320 MB/total
Decryption speed: 133,095663298251 MB/s, 2,4042857 seconds/total. 320 MB/total
Target 9: 1 op, 9660.7 ms, 9660717000 ns, 96607170 ticks, 9660717000 ns/op, 0.1 op/s
Encryption speed: 132,13622319658 MB/s, 2,4217432 seconds/total. 320 MB/total
Decryption speed: 133,264951754964 MB/s, 2,4012315 seconds/total. 320 MB/total
Target 10: 1 op, 9653.9 ms, 9653928300 ns, 96539283 ticks, 9653928300 ns/op, 0.1 op/s
// Benchmark finishedRunning Poly1305 hashing benchmark
Hashing speed: 56,1457467789624 MB/s, 2,8497261 seconds/total. 160 MB/total
Running ChaCha20 enc/dec benchmark
Encryption speed: 134,302674075362 MB/s, 2,3826778 seconds/total. 320 MB/total
Decryption speed: 131,697236613346 MB/s, 2,4298156 seconds/total. 320 MB/totalDecryption on Salsa/Chacha is slightly slower than encryption, this is a normal behavior as encryption operations are little more efficient.
I'm preparing multiple optimizations, mainly for ChaCha20.
- Internal state can be accessed(read/store op) and represented as ulong[]. (to improve performance for 64-bit platforms)
- We can unroll partially/fully core function to get little boost.
- Fully vectorize code (SSE, AVX)
- Paralellize chacha to run multiple quater-round functions (each on different block)
- We can try pre-generate keystream material based on the message size and then xor all at once (both ops at batches)
- We can possibly even pre-generate keystream material and cache it in memory (can attacker gain any insides?) and then finally xor keystream when requested (significant boost).
We need to improve Poly1305 from ref. implementation to vectorized one (challenging) or at least use 64-bit instructions, because the gap between Poly1305 speed and symmetric ciphers is too big to be used efficiently in AEAD structure (~55MB/s vs. ~132MB/s = waiting on Poly1305 all the time).