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
nonce preparation in Encrypt and Decrypt causes an allocation. In an application encrypting/decrypting at 200k+ times a second this becomes rather noticeable in the garbage collector.
One way I've been thinking of working around this is to provide a function similar to this:
Obviously there are a handful of issues here, is the byte array big enough, too big, being used by another thread? Adding (some of) those checks would still likely be less overhead though.
I can bring crypto into my part of the program, but this feels bad:
nonce
preparation inEncrypt
andDecrypt
causes an allocation. In an application encrypting/decrypting at 200k+ times a second this becomes rather noticeable in the garbage collector.One way I've been thinking of working around this is to provide a function similar to this:
Obviously there are a handful of issues here, is the byte array big enough, too big, being used by another thread? Adding (some of) those checks would still likely be less overhead though.
I can bring crypto into my part of the program, but this feels bad:
Other thoughts would be to internalize a
heap
for storingnonce
byte arrays.Wanted to get your thoughts on the matter before I sent any PRs your way, thanks!
The text was updated successfully, but these errors were encountered: