15

他把闲鱼 APP 长列表流畅度翻了倍

 3 years ago
source link: https://www.infoq.cn/article/Tx7AqAffco6p64T1ZfAQ
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

1 整体思路

闲鱼在业务的快速迭代过程中,app 的长列表滑动流畅度逐步恶化,对用户浏览内容体验产生伤害。闲鱼作为国内 flutter 应用的先驱,APP 以 flutter 和原生 Native 的混合工程存在。这里分别就 Android 原生、flutter 页面和大家分享我们的优化思路。

本文分为三个部分:

  1. 流畅度指标和检测工具构建

  2. 原生 Android 长列表优化

  3. flutter 长列表优化

流畅度优化整体思路图如下:

jIvyie.png!mobile

2 流畅度指标和检测工具构建

2.1 现状和难点

检测工具现状:以 Android 为例,现有流畅度工具可分为:

  • 侵入式

  • 集成 sdk,通过注册帧回调计算流畅度。Android 见 Choreographer 类

  • profile 模式

  • 无侵入式

  • 执行系统命令,如 adb shell dumpsys gfxinfo ${packageName}

  • 腾讯 GT APP,底层执行 service callSurfaceFlinger1013 ,高版本 Android 已不支持

流畅度指标现状有:

  • FPS (Frames Per Second)

  • SF(SkippedFrame,跳帧) app 在单位时间 1 秒内,跳过执行 Choreographer 中 doFrame() 的次数

  • SM(Smooth,流畅度) app 在单位时间 1 秒内,实际执行 Choreographer 中 doFrame() 的次数。其中 SM=60-SF。

  • 帧耗时数据 使用 adb 命令得到几个关键分位的帧平均耗时:

MJfQjub.png!mobile

然而以上工具和指标定义在 app 的复杂场景下,尚存在问题

  • 多平台问题

现 APP 技术有原生、h5、小程序、RN、weex、flutter 等。暂无一款无侵入的流畅度检测工具能同时支持多个平台、多种机型和多个指标数据,而侵入式的检测工具无法检测竞品 APP。

  • 指标选择和用户体验一致性

我们期望能有少量的几个指标数据,准确的表达用户流畅度体感。平均 FPS(SM 和 SF 类似),不足以反映用户体验。如相同 30 FPS,可以是 1s 内 30 个 33.3 ms的画面,也可以是 29 个 16.6ms 的画面再加 1 个 516.9 ms 的画面,但用户体验并不相同。

  • 流畅度数据影响因素多


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK