-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimize session auth tag generation
I profiled my application and crypto/hmac.New was taking 5.71% of the total CPU time. Since the session key does not change, you can call crypto/hmac.Reset() instead of making a new object. This reuses previous work done for the key. name old time/op new time/op delta EncryptRTP-8 2.17µs ± 4% 1.90µs ± 5% -12.79% (p=0.008 n=5+5) EncryptRTPInPlace-8 2.14µs ± 4% 1.84µs ± 4% -13.79% (p=0.008 n=5+5)
- Loading branch information
Showing
3 changed files
with
42 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters