nervosnetwork / tentacle

A multiplexed p2p network framework that supports custom protocols
https://docs.rs/tentacle
MIT License
54 stars 24 forks source link

feat: Aes algorithm hardware acceleration #190

Closed driftluo closed 5 years ago

driftluo commented 5 years ago

On my machine:

$ cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c
      8  Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz

before:

1kb_aes128              time:   [9.4003 ms 9.4581 ms 9.5252 ms]                        
                        change: [+4.0887% +5.0088% +5.9171%] (p = 0.00 < 0.05)
                        Performance has regressed.
1kb_aes256              time:   [11.567 ms 11.638 ms 11.712 ms]                        
                        change: [+0.8615% +1.9225% +2.8798%] (p = 0.00 < 0.05)
                        Change within noise threshold.
1mb_aes128              time:   [36.289 ms 36.395 ms 36.521 ms]                        
Found 3 outliers among 100 measurements (3.00%)
  3 (3.00%) high mild
1mb_aes256              time:   [46.033 ms 46.292 ms 46.606 ms]                        
Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) high mild

after:

1kb_aes128              time:   [3.3078 ms 3.3222 ms 3.3390 ms]                        
                        change: [-65.736% -65.394% -65.066%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 10 outliers among 100 measurements (10.00%)
  9 (9.00%) high mild
  1 (1.00%) high severe
1kb_aes256              time:   [3.5324 ms 3.5444 ms 3.5574 ms]                        
                        change: [-69.653% -69.430% -69.212%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 6 outliers among 100 measurements (6.00%)
  3 (3.00%) high mild
  3 (3.00%) high severe
1mb_aes128              time:   [13.379 ms 13.430 ms 13.486 ms]                        
                        change: [-63.624% -63.383% -63.125%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 10 outliers among 100 measurements (10.00%)
  5 (5.00%) high mild
  5 (5.00%) high severe
1mb_aes256              time:   [14.268 ms 14.306 ms 14.345 ms]                        
                        change: [-69.442% -69.242% -69.047%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) high mild
driftluo commented 5 years ago

Because of https://github.com/RustCrypto/stream-ciphers/issues/12, I think we should follow industry standards.

I will switch all encryption related libraries to openssl and ring to ensure compliance with industry standards.