Introducing Nanoscope: An Extremely Accurate Method Tracing Tool for Android Development
Article Summary
Uber's Android team hit a wall: their profiling tools were either too slow or too inaccurate to debug real performance issues.
When Uber's Mobile Engineering team set out to speed up their app by 50%+, they found Android Studio's method tracing slowed execution by orders of magnitude, while sampling missed critical details. So they built their own solution and open-sourced it.
Key Takeaways
- Nanoscope adds only 20 nanoseconds overhead per method vs Android Studio's massive slowdown
- Achieved under 10% total overhead during app startup sequences
- Required forking AOSP to integrate directly with OS for extreme performance
- Discovered TextView autosizing is much slower without granularity settings
- Uses inline assembly in compiled methods to avoid function call overhead
Critical Insight
Uber built a method tracing tool that's accurate enough for production debugging while adding just 20 nanoseconds per method call.