-
Notifications
You must be signed in to change notification settings - Fork 14
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
Consider providing hash implementation for public types #23
Comments
Can you provide a use case? |
Cache individual svg elements rendered canvases based on the declaration |
It would be highly problematic to implement. Not to mention very slow. usvg nodes are very complex. In the worst case we could try adding UUID for each node, so it could be used for hash instead. |
I already have a fork of your repo with hash implementation and rerendering the element is much slower than hashing every node. Using ids is not possible because I need to specifically detect if the element was changed. |
Of course rendering is slower, but slow caching isn't a solution either. I will think about it. For now just fork.
Elements are immutable since recently. |
This will involve some work around the floats to make them hashable. In the case of SVG types I think we can even do the simple
.to_bits().hash()
with additional check for theNaN
value, but also we can use more robust way like https://github.com/reem/rust-ordered-float/blob/master/src/lib.rsIf you accept this I can open a PR
The text was updated successfully, but these errors were encountered: