Closed taneliang closed 4 years ago
This pull request is being automatically deployed with Vercel (learn more). To see the status of your deployment, click below or on the icon next to each commit.
🔍 Inspect: https://vercel.com/mlh-fellowship/scheduling-profiler-prototype/cfigsf61x ✅ Preview: https://scheduling-profiler-prototype-git-eliang-ff-scroll.mlh-fellowship.vercel.app
Resolves #105 with 2 strategies
Close paths before clipping. In Firefox, the
clip
method took a very long time to run as therect
s seem to build up over time. Wrapping therect
call inbeginPath
andclosePath
seems to reduce the amount of work thatclip
does. Scroll performance in Firefox is back to normal (~20-30 FPS)Before (https://share.firefox.dev/3iaqE5W):
After (https://share.firefox.dev/39UvDET):
Cache canvas bounding rect if the canvas size does not change.
Correctness: This implementation remains correct because our canvas takes up the whole page, and any change in the actual bounding rect will always result in a canvas width/height change, triggering cache invalidation.
Improvement: This does not result in any noticeable improvement, but
getBoundingClientRect
was significant enough to show up in performance profiles.