前端大势所趋---Flutter 这篇文章会让你行动起来( 五 )


通过对比我们了解到 , flutter 版的 apk 大小会比 android 原生的多出约 6M 左右 , 其中核心引擎大约 3.2MB , 框架+应用程序代码大约是 1.25MB , 必需的 Java 代码 .dex 将近 60k , 而 assets 文件里还约有 2.1MB 的 ICU 数据等 , 单纯从安装包上来说 , 原生是要优于 flutter 的 。

运行性能测试

为了测试覆盖更加充分 , 我们分别在 debug 和 release 模式上进行性能测试 。 而据官方介绍 flutter 的 debug 模式在性能上是要略于 release 版的 , 所以他们提供了 profile 模式供我们测试 , profile 模式编译和启动 Flutter 应用程序几乎与 release 模式完全相同 。
我们先看 android 原生的 debug 和 flutter 的 proflle 模式性能对比这里我们用 Android Profiler 进行性能指标检测 , demo 只有一个界面 , 用 ListView 展示 10000 条数据 。 下面看图:

android原生debug性能检测图

flutter profile性能检测图

推荐阅读