tfjs icon indicating copy to clipboard operation
tfjs copied to clipboard

[WebGL] Optimize the async read

Open qjia7 opened this issue 3 years ago • 3 comments

The async read in backend_webgl.ts always creates a new PIXEL_PACK_BUFFER buffer. Once the download is finished, delete it in GPU. So this buffer is created and deleted over and over again when the same model is predicted multiple times. I think it may more or less impact the performance. We should cache this buffer and avoid to create a new one if the size doesn't change like the texture.

qjia7 avatar Sep 02 '22 00:09 qjia7

@Linchenn FYI. I just noticed it when I look at the webgl implementation. I don't know how much it will help the perf. But from the code design, I think we should cache it. Do you want to take a look?

qjia7 avatar Sep 02 '22 00:09 qjia7

Thank you for catching it up! Will take a look at this.

Linchenn avatar Sep 02 '22 02:09 Linchenn

👏🏼

danwexler avatar Sep 02 '22 03:09 danwexler