generated from napi-rs/package-template
-
-
Notifications
You must be signed in to change notification settings - Fork 78
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
drawImage performance bug with canvas #972
Comments
ran benchmark on my mac pro 14 M2 Max 64G
then added a canvas on canvas draw to both tests: // start of drawGradient() and drawHouse()
const canvas = factory(1024, 768)
const canvas2 = factory(1920, 1080)
const ctx = canvas.getContext('2d')!
const ctx2 = canvas2.getContext('2d')!
// the test's canvas drawing commands
// draw the canvas on a canvas
ctx2.drawImage(canvas, 0, 0, canvas2.width, canvas2.height)
// rest of test
drops to about 62 to 65 % of skia-canvas performance |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Drawing a canvas onto a canvas is almost 8 times slower than drawing an image onto a canvas:
outputs:
average draw image time 1.2156541699999999
average draw canvas time 8.897838329999999
On the web the two draw in about the same amount of time. 7 milliseconds can make a huge amount of difference when you might have a 16 millisecond budget rendering at 60Hz.
My stab in the dark guess is that somewhere along the way there's a mem copy happening.
Something similar to:
Buffer.from(imageData.data.buffer))
vsBuffer.from(imageData.data))
The text was updated successfully, but these errors were encountered: