Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Round font sizes to the nearest tenth.
Summary: Using random font sizes explodes memory use because processing.js caches PFont instances using the the font name and size as the cache key. Because the size is random, none of the cached font instances are reused because we keep caching them. A better solution would be to use a LRU (Least Recently Used) cache like jscache. If this continues to be a problem we can look into changing the cache system. Test Plan: - open demos/simple/index.html in live-editor (in Firefox) and type the following code: ``` draw = function() { textSize(random(10,30)); }; ``` - check memory use using `top` or Activity Monitor and very that it tops out around 2GB (as opposed to continually growing) Reviewers: pamela Reviewed By: pamela Subscribers: john Differential Revision: https://phabricator.khanacademy.org/D19308
- Loading branch information