canvas caching/pooling #14
Comments
This request seems reasonable. Currently, a new canvas is created every time a watermark object calls I will take a look into this. The shared state of a pool provides some challenges for a functional style library, but I have seen similar scenarios overcome through the use of actors/signals in other languages. Bottom line: I hear you, and I will investigate. Might take some time to come up with an elegant solution though. Thank you for opening the issue :) |
I was able to figure out when/where the canvas is created, but not a clear idea how to pool canvases because I couldn't really figure out how to reclaim them to the pool. Basically, processing a lot of images creates a lot of canvases and IE is just extremely unhappy. You are welcome! |
@jakrzysztow sorry for the wait, I'm hoping you can take a peak at the work towards implementing the pool feature. I have a pull request here: #17 Files of interest might be the pool implementation, and its use in the main export watermark.js essentially reuses a canvas if available, or creates a new one, which in turn can be reused. This drastically limits the canvases created, but I was a little uncertain on an ideal "done" scenario, hence the |
Merged into master - will tag a new version with these changes |
Sorry to say I will have no way to test this as we no longer work on the project. I appreciate your work! |
We use watermarkjs in an application have found that canvases to not get garbage collected in IE. For other places in the system that are using canvases, we implemented a pooling system to reuse canvases.
Would like to know how to get watermarkjs to either do its own canvas pooling or how to add what we are doing and have one shared canvas pool.
The text was updated successfully, but these errors were encountered: