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

passing a buffer object to canvas.toBuffer to reduce gc thrash #2356

Open
mreinstein opened this issue Feb 26, 2024 · 0 comments
Open

passing a buffer object to canvas.toBuffer to reduce gc thrash #2356

mreinstein opened this issue Feb 26, 2024 · 0 comments

Comments

@mreinstein
Copy link

toBuffer is very handy for blitting a canvas into some other graphics system:

const buffer = canvas.toBuffer('raw')
// blit buffer here

It would be really nice to pass in an existing buffer as an optional parameter, so it could be re-filled on each toBuffer invocation.
That would cut down on gc pressure quite a bit, especially in a tight render loop.

@mreinstein mreinstein changed the title passing an buffer object to canvas.toBuffer to reduce gc thrash passing a buffer object to canvas.toBuffer to reduce gc thrash Feb 26, 2024
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

No branches or pull requests

1 participant