-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
_clipImageData is GC expensive #4197
Comments
Actually this might be an issue with the whole draw to cache call, closing for not until I understand the problem better and whether it's worth fixing. |
Looking at the code of that function, I think you can spare the new Uint8ClampedArray there by directly creating the ImageDate and writing to its The bytes also could be transferred as uint32, would make the function somewhat faster. |
Great idea, then it's just a new typed array view on the same buffer until we eventually throw it away after it gets drawn to the canvas! |
This makes clip image data around twice as fast, it's a little tricky to measure it though. Changes: - Work on Uint32Array instead of Uint8 so it's 1 assignment per pixel instead of 1 per channel. - Perform the clipping in-place using the original image data to avoid allocation a new buffer. Fixes xtermjs#4197
putImageData works a little differently to drawImage which confused me for a bit, you need to offset the destination as putImageData draws the 'dirty' parts of the texture using the same source image dimensions Fixes xtermjs#4197
Part of microsoft/vscode#161622
During vscode startup:
The text was updated successfully, but these errors were encountered: