fix(): object caching is over-invalidating the cache #10294
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Working on the demos on the website i noticed the demo with the rotating tigers is extremely choppy.
I debugged and the cache was always being invalidated.
The culprit was this line here:
https://github.com/fabricjs/fabric.js/pull/10294/files#diff-4be7e8bea1e16b55606e7a9b175fc2a6e2e6290a82f3aec65b39425510ca73a6L488
The cache canvas is always an integer, but the cache width/height could be any number.
On top of that our scaling cache optimization was adding extra pixel to the canvas making the size of the needed canvas always different from the actual size we were assigning to it, this was happening for every object that doesn't have an integer size or for an integer sized object that was scaled.
Unless i m seeing something wrong, cache has been broken for very long time.
In Action