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

canvas.draw_image is slow #261

Open
martinRenou opened this issue Apr 7, 2022 · 0 comments
Open

canvas.draw_image is slow #261

martinRenou opened this issue Apr 7, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@martinRenou
Copy link
Collaborator

The slow part in ipycanvas is here when we use an Image widget: https://github.com/martinRenou/ipycanvas/blob/master/src/widget.ts#L786-L789
the slowness comes from this function https://github.com/martinRenou/ipycanvas/blob/658929381918dd89dc7f38a735fa7f9148a85f2b/src/widget.ts#L43-L62 which transforms the Image widget into an actual JavaScript HTMLImageElement object

We could probably do it only once for each image widget (keeping the resulting HTMLImageElement in memory in a {"widget-model-id": HTMLImageElement} object, we can also automatically update this mapping if we see changes in the Image model).

That way animating an image would be more performant.

@martinRenou martinRenou added the enhancement New feature or request label Apr 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant