Tags: icn-team/srtp
Tags
Use speedy XOR from pion/transport Now that we have a speedy version of xorBytes in pion/transport, we might as well use it. Benchmarks indicate an improvement of 10% to 20% in CTR encryption speed for large blocks, depending on the architecture. Also remove TestXorBytesBuffer, which is no longer relevant.
Optimise away calls to cipher.NewCTR This avoids the allocation of a 512-byte buffer on each packet, which leads to a 30% to 50% speedup in the SRTP benchmaks. ``` name old time/op new time/op delta EncryptRTP-8 1.58µs ± 8% 1.06µs ± 2% -33.13% EncryptRTPInPlace-8 1.54µs ± 3% 1.00µs ± 1% -34.82% DecryptRTP-8 1.44µs ± 6% 0.67µs ± 2% -53.80% Write-8 1.65µs ±10% 1.08µs ± 1% -34.60% WriteRTP-8 1.52µs ± 2% 1.01µs ± 3% -33.75% name old speed new speed delta EncryptRTP-8 71.1MB/s ± 8% 106.1MB/s ± 2% +49.24% EncryptRTPInPlace-8 72.9MB/s ± 3% 111.7MB/s ± 1% +53.26% DecryptRTP-8 19.4MB/s ± 6% 42.0MB/s ± 2% +116.24% Write-8 68.2MB/s ± 9% 103.9MB/s ± 1% +52.42% WriteRTP-8 73.6MB/s ± 2% 111.0MB/s ± 3% +50.94% name old alloc/op new alloc/op delta EncryptRTP-8 884B ± 0% 292B ± 0% -66.97% EncryptRTPInPlace-8 756B ± 0% 164B ± 0% -78.31% DecryptRTP-8 780B ± 0% 188B ± 0% -75.90% Write-8 916B ± 0% 324B ± 0% -64.63% WriteRTP-8 804B ± 0% 212B ± 0% -73.63% name old allocs/op new allocs/op delta EncryptRTP-8 9.00 ± 0% 7.00 ± 0% -22.22% EncryptRTPInPlace-8 8.00 ± 0% 6.00 ± 0% -25.00% DecryptRTP-8 9.00 ± 0% 7.00 ± 0% -22.22% Write-8 9.00 ± 0% 7.00 ± 0% -22.22% WriteRTP-8 8.00 ± 0% 6.00 ± 0% -25.00% ```
PreviousNext