You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// A cipher is an instance of AES encryption using a particular key.
typeaesCipherstruct {
enc []uint32
dec []uint32
}
These slices have lengths between 44 and 60 bytes, depending on the AES variant (AES-128, AES-192, AES-256). By replacing them with a fixed-size 60 element array (plus one length field), the number of allocations can be reduced significantly. This also reduces pointer chasing when encrypting / decrypting data.
What did you expect to see?
I'm going to submit a CL that implements this suggestion.
The text was updated successfully, but these errors were encountered:
I've made a similar change before in CL CL 461078, but this seems better. I will abort that change.
mateusz834
added
FixPending
Issues that have a fix which has not yet been reviewed or submitted.
and removed
NeedsFix
The path to resolution is known, but the work has not been done.
labels
Feb 4, 2024
Go version
go version go1.21.4 darwin/arm64
Output of
go env
in your module/workspace:What did you do?
I'm the maintainer of quic-go, and I'm working on reducing the allocations during the QUIC handshake (tracking issue).
What did you see happen?
The major source of allocations lies in the standard library, especially the crypto packages. Creating AES ciphers is part of this.
The allocations coming from the two slices embedded in
aesCipher
could easily be avoided:go/src/crypto/aes/cipher.go
Lines 17 to 21 in b8ac61e
These slices have lengths between 44 and 60 bytes, depending on the AES variant (AES-128, AES-192, AES-256). By replacing them with a fixed-size 60 element array (plus one length field), the number of allocations can be reduced significantly. This also reduces pointer chasing when encrypting / decrypting data.
What did you expect to see?
I'm going to submit a CL that implements this suggestion.
The text was updated successfully, but these errors were encountered: