-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Open
Labels
NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.Performance
Milestone
Description
The function crypto/cipher.xorBytes implements the XOR operations between slices of bytes, and is heavily used by encryption in CTR mode. The version in the stdlib has seen a significant amount of optimisation, but some easy optimisations are missing:
- The variable
supportUnalignedin xor_generic.go should be set for GOARCH equal toarm64. - Said variable sohould be set for GOARCH equal to ARM and GOARM equal to 6 or 7 (but not 5).
- When
supportsUnalignedis not set, the fast version should still be called when both src and dst are multiples of wordSize (this actually happens fairly often, e.g. when encrypting a freshly allocated slice); - When
supportsUnalignedis not set, and src and dst are equal modulo wordSize, then the initial bytes should be xored and then the fast version called on the rest of the array; - Ideally, there should be a NEON implementation for ARMv7.
Points 1 through 3 are fairly trivial, and would bring a significant part of the benefit. This is related to #53021.
Metadata
Metadata
Assignees
Labels
NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.Performance