Closed EmrysMyrddin closed 1 year ago
Could I have a try to resolve this issue?
Is there need to add sync.Pool? Whenever there is the call to ReaderFunc, there is also mutex Lock, so here we could use closure instead as there is no concurrent access to the buffers.
Can we close the issue?
Since #418, the I420 conversion have been slow down because 2 new buffers are allocated for each frame converted.
The idea is to use a
sync.Pool
to minimise the overhead of creating new[]byte
:[]byte
withPool.Get
,Pool.Put
function with the used[]byte
buffers.This way we should limit the garbage collector pressure and the time needed to fill the
[]byte
with 0 values at creation.