Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove constant allocations from AEAD_AES_GCM #170

Merged
merged 1 commit into from
Oct 31, 2021
Merged

Remove constant allocations from AEAD_AES_GCM #170

merged 1 commit into from
Oct 31, 2021

Conversation

agnivade
Copy link
Contributor

We remove all cases of constant allocations with an array
declaration which makes all of them to be allocated on stack instead.

Before:

./srtp_cipher_aead_aes_gcm.go:22:7: &srtpCipherAeadAesGcm{} escapes to
heap
./srtp_cipher_aead_aes_gcm.go:151:12: make([]byte, 12) escapes to heap
./srtp_cipher_aead_aes_gcm.go:73:22: make([]byte, size) escapes to heap
./srtp_cipher_aead_aes_gcm.go:94:22: make([]byte, size) escapes to heap
./srtp_cipher_aead_aes_gcm.go:170:12: make([]byte, 12) escapes to heap
./srtp_cipher_aead_aes_gcm.go:111:22: make([]byte, size) escapes to heap
./srtp_cipher_aead_aes_gcm.go:114:42: make([]byte, 12) escapes to heap
./srtp_cipher_aead_aes_gcm.go:131:22: make([]byte, size) escapes to heap
./srtp_cipher_aead_aes_gcm.go:134:42: make([]byte, 12) escapes to heap
./srtp_cipher_aead_aes_gcm.go:187:13: make([]byte, 12) escapes to heap

After:

./srtp_cipher_aead_aes_gcm.go:22:7: &srtpCipherAeadAesGcm{} escapes to
heap
./srtp_cipher_aead_aes_gcm.go:73:22: make([]byte, size) escapes to heap
./srtp_cipher_aead_aes_gcm.go:94:22: make([]byte, size) escapes to heap
./srtp_cipher_aead_aes_gcm.go:111:22: make([]byte, size) escapes to heap
./srtp_cipher_aead_aes_gcm.go:131:22: make([]byte, size) escapes to heap

We remove all cases of constant allocations with an array
declaration which makes all of them to be allocated on stack instead.

Before:

```
./srtp_cipher_aead_aes_gcm.go:22:7: &srtpCipherAeadAesGcm{} escapes to
heap
./srtp_cipher_aead_aes_gcm.go:151:12: make([]byte, 12) escapes to heap
./srtp_cipher_aead_aes_gcm.go:73:22: make([]byte, size) escapes to heap
./srtp_cipher_aead_aes_gcm.go:94:22: make([]byte, size) escapes to heap
./srtp_cipher_aead_aes_gcm.go:170:12: make([]byte, 12) escapes to heap
./srtp_cipher_aead_aes_gcm.go:111:22: make([]byte, size) escapes to heap
./srtp_cipher_aead_aes_gcm.go:114:42: make([]byte, 12) escapes to heap
./srtp_cipher_aead_aes_gcm.go:131:22: make([]byte, size) escapes to heap
./srtp_cipher_aead_aes_gcm.go:134:42: make([]byte, 12) escapes to heap
./srtp_cipher_aead_aes_gcm.go:187:13: make([]byte, 12) escapes to heap
```

After:

```
./srtp_cipher_aead_aes_gcm.go:22:7: &srtpCipherAeadAesGcm{} escapes to
heap
./srtp_cipher_aead_aes_gcm.go:73:22: make([]byte, size) escapes to heap
./srtp_cipher_aead_aes_gcm.go:94:22: make([]byte, size) escapes to heap
./srtp_cipher_aead_aes_gcm.go:111:22: make([]byte, size) escapes to heap
./srtp_cipher_aead_aes_gcm.go:131:22: make([]byte, size) escapes to heap
```
@codecov
Copy link

codecov bot commented Oct 31, 2021

Codecov Report

Merging #170 (dff36f5) into master (eda10ea) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #170   +/-   ##
=======================================
  Coverage   76.12%   76.12%           
=======================================
  Files          16       16           
  Lines         775      775           
=======================================
  Hits          590      590           
  Misses        103      103           
  Partials       82       82           
Flag Coverage Δ
go 76.12% <100.00%> (ø)
wasm 75.61% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
srtp_cipher_aead_aes_gcm.go 70.73% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update eda10ea...dff36f5. Read the comment docs.

@Sean-Der Sean-Der merged commit 1d7627e into pion:master Oct 31, 2021
@agnivade agnivade deleted the gcm_opt branch November 1, 2021 04:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants