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
Since the 'meat' of xorBytesCTR is xor.XorBytes, we would hope to find most of the time spent in xorBytesCTR being spent in xor.XorBytes. But this isn't the case, which points at the allocations being the biggest consumers of CPU. We could probably eliminate this via usage of Sync.Pool. There are probably other places that would benefit too, wherever small buffers are frequently allocated, not just here.
The text was updated successfully, but these errors were encountered:
There are 'hot' places in the code that allocate (and then need to GC) lots of small buffers, e.g. https://github.com/pion/srtp/blob/b2c2ab8afc1745b80378f66014934bd9111140aa/crypto.go#L24
Would it be better to use Sync.Pool?
Some data: pprof / top 20 shows something like this:
Since the 'meat' of xorBytesCTR is xor.XorBytes, we would hope to find most of the time spent in xorBytesCTR being spent in xor.XorBytes. But this isn't the case, which points at the allocations being the biggest consumers of CPU. We could probably eliminate this via usage of Sync.Pool. There are probably other places that would benefit too, wherever small buffers are frequently allocated, not just here.
The text was updated successfully, but these errors were encountered: