kanvas-ios
kanvas-ios copied to clipboard
Adds cache to store expensive frame data
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
andMetal Filters
flags. - Add multiple images
- Switch between images
- Notice the speed increase
Profiling
Before

A single frame switch takes > 1s:

After
Much shorter durations seen in the graph:

A single frame switch takes ~ 100ms:
