UIImageView vs Metal
summary
Built a small MetalImageView wrapper and benchmarked it against UIImageView in a table view using large images. Early CPU-only timing shows 0.02–0.05 ms per render (10–20× faster), but correct end-to-end timing including GPU shows 40–200 ms and visible stutter. Using Instruments Metal System Trace reveals a 20–500 ms texture load hotspot; fixing it by merging resize+render into one command buffer and caching MTL textures removes round trips and restores smooth scrolling. Key takeaways: UIKit already uses Metal, measure GPU time, avoid CPU/GPU round trips, cache GPU resources.
AI-written summary · about
chapters (16)
- 0:00UIImageView vs Metal
- 2:09Framebuffer and GPU roles
- 4:26CPU vs GPU processing
- 6:17MetalとOpenGLの違い
- 7:43Metal wrapper class proposal
- 8:45Performance test overview
- 10:35Measurement contradictions and causes
- 11:23CPU-GPU processing flow basics
- 14:00UIKit leveraging Metal
- 15:49GPU processing time importance
- 16:37Metal System Traceによる分析
- 18:54Resize and rendering optimizations
- 21:31CPU-GPU processing efficiency
- 22:38Texture cache importance
- 24:07Memory layout for resources
- 25:13Summary and Q&A
related talks
41mGPUImage 3: From OpenGL to Metal
24mSwiftUI Performance Tips
40mHeavy Metal: Creating beauty with SwiftUI shaders
11mLightning: How fast can you rotate an image?
30mFrom Slow to Flow: Tips for Accelerating Your App Performance
23mUnderstanding Render Loop to optimise SwiftUI
38mBuilding Responsive Interactions
22mRendering beautiful text using MSDFs and Metal.
