kanvas-ios icon indicating copy to clipboard operation
kanvas-ios copied to clipboard

Adds cache to store expensive frame data

Open bjtitus opened this issue 4 years ago • 0 comments

This adds a cache which EditorViewController can use to store expensive values calculated from media. For now, that consists of the media's dominant color data used by EditorViewController.addCarouselDefaultColors(). This dramatically speeds up switching between media. Eventually, I think we could investigate speeding up the dominant color process, but we don't need to redo this each time when switching.

Testing

  • Enable the Multiple Exports, Camera Metal and Metal Filters flags.
  • Add multiple images
  • Switch between images
  • Notice the speed increase

Profiling

Before

Screen Shot 2021-02-12 at 10 25 54 AM

A single frame switch takes > 1s:

Screen Shot 2021-02-12 at 10 26 36 AM

After

Much shorter durations seen in the graph:

Screen Shot 2021-02-12 at 10 24 25 AM

A single frame switch takes ~ 100ms:

Screen Shot 2021-02-12 at 10 25 17 AM

Time Profiler Traces

BeforeCache.trace.zip AfterCache.trace.zip

bjtitus avatar Feb 12 '21 17:02 bjtitus