Flutter Jun 14, 2021

Improving Platform Channel Performance in Flutter

Article Summary

Aaron Clarke from Google's Flutter team eliminated unnecessary memory copies in platform channels and achieved up to 52% performance gains. Here's how he debugged his way through Objective-C class clusters and JNI limitations.

Platform channels are the bridge between Flutter and native iOS/Android code, but they were copying message data 4+ times during each round trip. Clarke spent months profiling, debugging compilation flags, and navigating memory management across C++, Objective-C, and Java to eliminate these bottlenecks.

Key Takeaways

Critical Insight

By removing superfluous data copies and transferring memory ownership directly to native platforms, Flutter platform channels now run up to 52% faster for binary data.

Clarke's next move: implementing FFI platform channels that skip thread hopping entirely and a custom MessageCodec for Pigeon that ditches reflection.

Recent from Flutter

Related Articles