cloudflare / circl

CIRCL: Cloudflare Interoperable Reusable Cryptographic Library
http://blog.cloudflare.com/introducing-circl
Other
1.3k stars 144 forks source link

kyber: reduce allocations #287

Closed bwesterb closed 3 years ago

armfazh commented 3 years ago

could you share the benchcmp diff of the changes

bwesterb commented 3 years ago
name                        old time/op  new time/op  delta
GenerateKeyPair/Kyber512-8  19.3µs ± 1%  19.3µs ± 1%    ~     (p=0.548 n=5+5)
Encapsulate/Kyber512-8      14.5µs ± 1%  14.4µs ± 1%  -1.02%  (p=0.032 n=5+5)
Decapsulate/Kyber512-8      15.5µs ± 8%  14.5µs ± 2%  -6.10%  (p=0.016 n=5+5)
bwesterb commented 3 years ago

(The real advantage, though, is probably higher than shown in such a benchmark — cf. #282)

armfazh commented 3 years ago

Enable -benchmem flag to see the improvements in memory allocs.

bwesterb commented 3 years ago
name                        old allocs/op  new allocs/op  delta
GenerateKeyPair/Kyber512-8      7.00 ± 0%      5.00 ± 0%   ~     (p=1.000 n=1+1)
Encapsulate/Kyber512-8          6.00 ± 0%      3.00 ± 0%   ~     (p=1.000 n=1+1)
Decapsulate/Kyber512-8          3.00 ± 0%      1.00 ± 0%   ~     (p=1.000 n=1+1)