Inside the Smart Media Engine: Handling images blazingly fast
A major challenge with clipboard managers is handling rich media. Text is cheap, but images, screenshots, and rich formatting can quickly bloat an app's database, causing UI stutter and lag.
Bypassing CoreData Bloat
Initially, we tried storing everything inside a CoreData or SQLite database. But storing large binary blobs (like Retina screenshots) directly in the database slows down read/write times significantly. When you trigger ClipDeck, you expect it to appear in under 50ms.
Our solution was the Smart Media Engine. Instead of forcing images into the database, ClipDeck writes them directly to your local disk as native PNG files inside the ~/Library/Application Support/dev.pythogen.ClipDeck/Images/ folder.
Lightning Fast Reads
Our lightweight history.json file simply stores a reference path to the image. When you open the UI, SwiftUI lazy-loads the images directly from disk. This keeps our memory footprint tiny and ensures the UI never drops a frame, even if you have hundreds of screenshots in your history.