Snapchat

Snapchat's Mobile Lens Profiler: Case Study

Original post Mobile Lens Profiler: Case Study

Article Summary

Snap's engineering team just dropped a masterclass in mobile performance debugging. Ever wonder why your AR lens stutters on the first frame?

Snap published a detailed case study walking through real-world profiling of a Snapchat Lens built with their Lens Studio 5.1. They used Google's Perfetto UI to trace performance on an iPhone 13, examining everything from lens activation to frame drops.

Key Takeaways

Critical Insight

The case study demonstrates how to pinpoint GPU driver stutters and texture upload bottlenecks that cause frame drops in AR experiences.

Continue reading

What This Article Covers

Problem

Snapchat's Lens Studio developers ran into a problem where frames took longer than 33ms to process when using the front camera. The first frame was especially slow compared to the rest, which they traced back to GPU driver behavior.

Solution

The team used Google's Perfetto UI to trace what was happening on an iPhone 13. They found that the Leather Jacket and Messy Hair assets were uploading textures to the GPU in a deferred way, and this was blocking the rendering thread when the initial draw calls happened.

Impact

Once the first frame finished, the lens ran at a steady 30 FPS. Over 12.7 seconds, it rendered 351 frames without dropping frames. Fixing the texture upload bottleneck let the lens handle complex assets without frame rate issues.

The trace reveals a hidden performance killer that happens before users even see your lens render.

This page summarizes “Mobile Lens Profiler: Case Study” by Snapchat, published Mar 15, 2023. All credit for the original work goes to the authors.

Read the original on developers.snap.com (opens in new tab)

AI tools for iOS

Browse all AI tools →