Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds cache to store expensive frame data #83

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft

Conversation

bjtitus
Copy link
Collaborator

@bjtitus bjtitus commented Feb 12, 2021

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

# Conflicts:
#	Classes/Camera/CameraController.swift
#	Classes/Camera/MediaArchiver.swift
#	Classes/Editor/EditorViewController.swift
#	Classes/Preview/CameraPreviewViewController.swift
- Remove drawing canvas changes
- Move Archive
- Add CodingKeys
- Move Frames
Reduces the impact of `EditorViewController.addCarouselDefaultColors` on time when switching frames.
@bjtitus bjtitus requested a review from danielebogo February 12, 2021 17:32
@bjtitus bjtitus self-assigned this Feb 12, 2021
@bjtitus bjtitus removed the request for review from danielebogo February 12, 2021 17:32
@bjtitus bjtitus marked this pull request as draft February 12, 2021 17:32
@bjtitus bjtitus requested review from danielebogo and removed request for danielebogo February 26, 2021 06:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant