Your Compose Code, on More Screens and Less CPU
If Codename One didn't exist, Kotlin Multiplatform is probably the platform I'd choose. I prefer Java, but Kotlin is a good language, and KMP was one of the strongest platforms we measured against in the Flutter post this week. Its first take on UI leaned on heavyweight native widgets, the way React Native does. The team learned from that, and Compose Multiplatform today is a good product built…
Codename One, an open-source framework for building native applications across multiple platforms, has partnered with Kotlin Multiplatform (KMP) to bring Compose Multiplatform to more screens and reduce CPU usage. Compose Multiplatform, which builds a Kotlin codebase for multiple targets, is now compatible with Codename One, enabling developers to reach more platforms with less work per frame.
The key differences between Compose Multiplatform and Codename One lie in their approach to UI and performance. Compose Multiplatform relies on heavyweight native widgets, while Codename One implements its own UI layer using Codename One components and graphics. Both platforms compile Kotlin for the JVM with their respective compiler plugins and use the Compose runtime and kotlinx.coroutines.
A benchmark comparing the three implementations—Compose Multiplatform on Codename One, Compose Multiplatform, and Java on Codename One—reveals that Compose Multiplatform on Codename One consumes less CPU time per frame (16.8 MB executable) compared to Compose Multiplatform (22.9 MB executable) and Java on Codename One (22.9 MB executable). This reduction in CPU usage translates to better battery life, reduced heat, and more headroom for smooth animations.
However, there are some caveats to consider. The benchmark was conducted on a simulator, not a physical device, and scrolling was done programmatically rather than through finger flings. Compose Multiplatform’s first frame marker fires before Skia draws, which may slightly favor its startup time. Additionally, an empty UIKit app took longer to start (640-750 ms) compared to the Codename One app.
Despite these factors, the benchmark results show that Compose Multiplatform on Codename One offers significant performance improvements over the other two implementations, especially in terms of CPU usage. The Kotlin Multiplatform approach allows developers to maintain a single codebase while delivering high-performance applications across multiple platforms.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.