Skip to content

feat: migrate account and network selectors to native list - #13209

Draft
huhuanming wants to merge 21 commits into
xfrom
codex/native-list-integration-env
Draft

feat: migrate account and network selectors to native list#13209
huhuanming wants to merge 21 commits into
xfrom
codex/native-list-integration-env

Conversation

@huhuanming

@huhuanming huhuanming commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

The account selector's wallet sidebar/accounts and the all-network/single-network selectors now use NativeList V2. V1 components and existing route names/parameters remain available for rollback. NativeList/native-image gaps are implemented through the repository's pinned 3.0.105 patches.

Account avatars now use stable URIs, native/Worker generation and persistent caching. The follow-up removes duplicate account/network calculations, coalesces value publications, prioritizes visible avatars, bounds pending disk work and limits account-list cache/group retention. Generic list/image scheduling stays in the module; balance aggregation and network-selection rules remain in selector business code.

Validation and current limits:

  • Original URI migration reduced the 1000-account snapshot from 22,847,723 to 736,723 bytes (96.8%). Generator/device PNG comparisons retain the V1 pixel results documented below.
  • Actual Desktop development-mode foreground testing: 12 steady samples at approximately 60 rAF FPS, zero intervals over 25 ms and zero JS long tasks. Six fresh-wallet cases at 1200/6500 CSS px/s contain 5318 sampled frames with zero unready avatar observations, reentries or row gaps. DOM observations are separate from frame-by-frame raster/panel proof.
  • Final iOS/Android Debug apps were rebuilt and tested. iOS index-rail dragging retains the modal, while header dragging dismisses it. Cold opening and first-scroll stalls remain above the frame budget: iOS recorded a 70 ms account interval; Android's original first-scroll sample recorded 213 ms.
  • A separate Android main-runtime sampling profile identifies repeated full-store SWR parse/prune/serialization during optimistic writes and background acknowledgements: 225 ms preparation task and a 67 ms scroll interval in that diagnostic run. A shared-storage fix has been proposed and is awaiting scope confirmation; the earlier unprofiled 213 ms interval is not retroactively assigned an exact stack.
  • Production Desktop account avatars now load after a file-origin Worker startup repair in NativeList; HTTP/extension Worker entry points and native sources are unchanged. Actual account/wallet scrolling records 1908 rAF intervals at approximately 120 FPS with no long tasks or intervals over 16.8 ms. These are two samples with three round trips each, not compositor proof. Modal opening/fresh wallet switches still record 33–42 ms intervals and two 50 ms tasks; the first modal is warmed, not process-cold. Recorded console errors are independently identified as the unsupported Sentry IPC URL scheme. Production network/continuous-avatar/memory measurements remain open.
  • Capacity controls bound the account-selector cache to three list scopes/6 Mi serialized characters. Short heap/DOM measurements do not establish an all-process memory ceiling or absence of leaks. Installed-extension, Release physical-device and high-refresh/compositor acceptance remain open.

Controlled account/network tests pass (18 + 10); the file-Worker repair passes eight startup behaviors against each src/lib entry, nine existing scheduling tests, strict TypeScript and 207-file pristine patch replay. The patch and report pass yarn agent:check --profile commit. Both native build runs reported the web-embed OCI 404 and succeeded using local fallback, not clean remote-cache hits. This PR remains a draft while the listed runtime failures are investigated.

Full measurement conditions, portable tables, provenance and reuse boundaries: NativeList selector performance report.

@socket-security

socket-security Bot commented Sep 7, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatednpm/​@​onekeyfe/​react-native-split-bundle-loader@​3.0.104 ⏵ 3.0.10776 -21006196 +1100
Updatednpm/​@​onekeyfe/​react-native-check-biometric-auth-changed@​3.0.104 ⏵ 3.0.10777 -51006496100
Updatednpm/​@​onekeyfe/​react-native-perf-memory@​3.0.104 ⏵ 3.0.10778 -31006496 +1100
Updatednpm/​@​onekeyfe/​react-native-native-logger@​3.0.104 ⏵ 3.0.10779 -31006496 +1100
Updatednpm/​@​onekeyfe/​react-native-keychain-module@​3.0.104 ⏵ 3.0.107831006596 +1100
Updatednpm/​@​onekeyfe/​react-native-app-update@​3.0.104 ⏵ 3.0.107821006596 +1100
Updatednpm/​@​onekeyfe/​react-native-scroll-guard@​3.0.104 ⏵ 3.0.10780 -31006696 +1100
Updatednpm/​@​onekeyfe/​react-native-device-utils@​3.0.104 ⏵ 3.0.10780 -31006696 +1100
Updatednpm/​@​onekeyfe/​react-native-cloud-kit-module@​3.0.104 ⏵ 3.0.107831006696 +1100
Updatednpm/​@​onekeyfe/​react-native-background-thread@​3.0.104 ⏵ 3.0.10781 -21006796 +1100
Updatednpm/​@​onekeyfe/​react-native-bundle-update@​3.0.104 ⏵ 3.0.10781 -21006796 +1100
Updatednpm/​@​onekeyfe/​react-native-auto-size-input@​3.0.104 ⏵ 3.0.10780 -31006796 +1100
Updatednpm/​@​onekeyfe/​react-native-ping@​3.0.104 ⏵ 3.0.10776 -31007096 +1100
Updatednpm/​@​onekeyfe/​react-native-lite-card@​3.0.104 ⏵ 3.0.107871007096100
Updatednpm/​@​onekeyfe/​react-native-dns-lookup@​3.0.104 ⏵ 3.0.107781007196 +1100
Updatednpm/​@​onekeyfe/​react-native-pbkdf2@​3.0.104 ⏵ 3.0.10776 -21007196 +1100
Updatednpm/​@​onekeyfe/​react-native-network-throttle@​3.0.104 ⏵ 3.0.10779 -11007196 +1100
Updatednpm/​@​onekeyfe/​react-native-network-info@​3.0.104 ⏵ 3.0.10776 -21007396 +1100
Updatednpm/​@​onekeyfe/​react-native-cloud-fs@​3.0.104 ⏵ 3.0.10781 -31007596 +1100
Updatednpm/​@​onekeyfe/​react-native-splash-screen@​3.0.104 ⏵ 3.0.10779 -31007696 +1100
Updatednpm/​@​onekeyfe/​react-native-tcp-socket@​3.0.104 ⏵ 3.0.10779 -21007696 +1100
Updatednpm/​@​onekeyfe/​react-native-zip-archive@​3.0.104 ⏵ 3.0.10780 -21007696 +1100
Updatednpm/​@​onekeyfe/​react-native-text-input@​3.0.104 ⏵ 3.0.107861007795 +1100
Updatednpm/​@​onekeyfe/​react-native-aes-crypto@​3.0.104 ⏵ 3.0.10780 -21007796 +1100
Updatednpm/​@​onekeyfe/​react-native-get-random-values@​3.0.104 ⏵ 3.0.10780 -31007896 +1100
Updatednpm/​@​onekeyfe/​react-native-image@​3.0.104 ⏵ 3.0.10778 +310099 +193 +2100
Updatednpm/​@​onekeyfe/​react-native-sni-connect@​3.0.104 ⏵ 3.0.10779 -410010096 +1100
Updatednpm/​@​onekeyfe/​react-native-bundle-crypto@​3.0.104 ⏵ 3.0.10779 -11008996 +1100
Addednpm/​@​onekeyfe/​react-native-native-list@​3.0.1077910010088100
Updatednpm/​@​onekeyfe/​react-native-skeleton@​3.0.104 ⏵ 3.0.10780 -31008096 +1100
Updatednpm/​@​onekeyfe/​react-native-pager-view@​3.0.104 ⏵ 3.0.10783 -21008096 +1100
Updatednpm/​@​onekeyfe/​react-native-async-storage@​3.0.104 ⏵ 3.0.10782 -21008096 +1100
See 6 more rows in the dashboard

View full report

@huhuanming
huhuanming force-pushed the codex/native-list-integration-env branch from 73dbb20 to 59768b3 Compare September 7, 2026 08:20
@huhuanming
huhuanming force-pushed the codex/native-list-integration-env branch from 59768b3 to 52fdb1b Compare September 7, 2026 09:01
@huhuanming

Copy link
Copy Markdown
Contributor Author

NativeList 性能验收更新(2026-09-07):已落地头像 URI / 磁盘缓存、账户与网络重复计算优化、缓存及原生 Cell 保留量限制,并修复生产 Desktop 的头像 Worker 启动问题。稳定滚动多数样本接近目标刷新节奏,但冷打开及首次滚动仍存在卡点,尚不能判定三端全场景满帧。

完整测量条件、原始证据索引、历史基线和构建来源见性能报告(固定版本)。本文汇总已保存的实测结果,不代表重新测量了当前整个 PR 分支。

测试范围是账户选择器的钱包侧栏、账户列表,以及网络选择器的所有网络、单一网络列表。V1 代码和原路由名称/参数保留,迁移使用 V2。

  • 账户压测:服务边界提供 1000 个钱包 × 每钱包 1000 个账户的逻辑数据,按需构建当前钱包,测试 fixture 的 LRU 最多保留 3 个钱包 / 3000 条账户记录。没有向数据库写入百万账户,不覆盖百万账户落库、地址派生或交易。正常页面仍使用原有真实钱包/账户服务,测量后已恢复 fixture。
  • 网络测试:使用 QA 环境正常网络数据,约 157 条所有网络行、177–178 条单网络行,包含结构行;配置和资产分组会因设备状态变化。
  • iOS:iPhone 17 Pro Simulator / iOS 26.5 / Debug。Android:API 36 arm64 emulator / Debug。Desktop:实际 Electron,并在每次帧率测量前后确认系统前台应用。
  • 本文 FPS 是 JS rAF FPS,不是录像帧数或屏幕实际呈现帧率。Native 稳态采样使用公开 scrollToOffset;Desktop 使用真实 CDP 鼠标滚动。手势冲突另用原生输入验证。
  • iOS/Android 的 main、bg 独立初始化、使用独立 JS 堆;头像生成/缓存使用进程内原生图片资源,后台负责通过共享原生 MMKV 持久化。Desktop 业务 main/bg 共用 renderer JS 线程,头像 Worker 和 Electron main 进程是独立资源;不能将 renderer 堆数据解释成全进程内存。

已完成的优化及可复用范围:

问题 已实现的改动 量化结果 / 复用边界
批量生成及传输账户头像阻塞 JS 列表仅传稳定 URI;原生/Worker 按需生成,内存与磁盘缓存复用,不在快照里传 PNG/Base64 1000 账户快照 22,847,723 → 736,723 bytes,减少 96.8%;头像视觉 JSON 22,389,001 → 302,001 bytes,减少 98.7%。移除了包含早期约 7.2 秒长任务的批量生成路径;7.2 秒是整个 JS 任务,不是独立 PNG 编码耗时
账户列表重复 diff、格式化和状态发布 每轮 diff 只算一次;跳过相同内容;按账户/格式化上下文失效;合并结果并分批让出线程 控制测试中状态发布 40 → 4,相同结果刷新 0;保留 20 次 × 50 账户请求。这是业务层优化,状态发布次数不是 React commit 数,也不是页面提速倍数
网络选择重复查询和行内容计算 去掉多余缺失地址查询触发;金额/图片描述与勾选状态分别复用 三条网络加资产标题、初次渲染及一次勾选的控制测试:缺失地址调用 4 → 2、金额查找 6 → 3、格式化 8 → 4、图片构建 6 → 3。属于网络选择业务层
新区域头像等待、重复请求 可见区域/滚动方向优先;合并与取消请求;显示不等待写盘完成;磁盘读取等待设置 8 ms 软预算,写入放到空闲期并限制队列 NativeList 的图片调度能力可复用;生成头像缓存适用于既有 onekey-avatar://blockie/v1/ URI,普通 HTTP 图片继续原图片加载器。8 ms 不保证生成、解码、绘制也在 8 ms 内完成
缓存和分组 Cell 历史容量保留 账户缓存最多 3 个列表上下文 / 6 Mi 序列化字符;复用时回收多余分组子视图;限制头像待写队列 账户缓存限制属于业务命名空间;分组池属于通用 NativeList。iOS 分组从 32 个子成员缩到 2 个后,窗口层级可达 Cell 数 43 → 18,后续真实拖动仍正确;这不是全部已分配 Cell 或 RSS 的统计
iOS indexedbar 与下拉关闭 modal 冲突 索引栏起手的触摸由索引栏处理 最终构建中 All networks 索引栏上下拖动保持 modal,标题区域向下拖动仍关闭;本轮未重测 Single network 的索引手势
Desktop 生产版头像 Worker 无法启动 file: 资源经过现有文件拦截器读取后创建 Blob Worker,处理启动合并/取消/旧实例事件,并释放脚本 Blob URL 实际生产页面账户头像加载通过;独立 file-origin 探针完成 IndexedDB 写入 → 新 Worker 读回 → 删除。HTTP/extension Worker 入口、原生代码、公共声明及安全配置保持原行为

滚动 FPS 汇总如下,每个原生/开发版列表有 3 个样本;生产 Desktop 是账户、钱包各 1 个样本,每个样本 3 轮往返:

环境 账户列表 钱包列表 所有网络 单一网络
iOS Debug 59.537–59.999 59.999–60.000 59.989–60.002 60.000–60.004
Android Debug 57.701–59.996 59.998–60.002 58.211–60.000(含准备阶段) 59.844–59.999
Desktop 开发版 60.000–60.011 60.000–60.005 59.996–60.004 59.998–60.008
Desktop 生产版 120.005 119.989 尚未补测 尚未补测

平均 FPS 不能代替卡顿检查,最差间隔和长任务如下:

  • Desktop 开发版:四个列表共 12 样本、3873 个帧间隔,最大 17.8 ms0 个 >25 ms 间隔、0 个 JS 长任务。检查点挂载行数为账户 18、钱包 14、所有网络 21、单网络 24,不是连续监测的最大值。
  • Desktop 生产版:账户和钱包共 1908 个帧间隔,最大 9.4 ms,P95 分别 9.3 / 9.2 ms0 个 >16.8 ms 间隔、0 个长任务。测量分辨率为 1200 × 675 CSS px、DPR 2。约 120 Hz 与开发版约 60 Hz 的节奏和几何条件不同,不能解读为性能翻倍或屏幕呈现验收通过。
  • iOS:4680 个帧间隔;账户一次 70.154 ms 间隔,伴随 67.798 ms 长任务;钱包一次 26.208 ms 间隔,无长任务。所有网络/单网络最大 17.87 / 17.56 ms,无长任务。其余 10 个样本没有 >25 ms 间隔或样本内长任务。准备阶段另外记录 6 个长任务,最大 344.517 ms,没有跨越准备/正式采样边界。
  • Android:账户存在 212.821 ms 的真实滚动窗口间隔,另有 68.469 ms 间隔,不能扣作准备阶段;钱包最大 20.31 ms。所有网络的 190.019 ms 间隔完全处于准备阶段,另有 54.293 ms 间隔跨越滚动开始边界,不能将 190 ms 报成持续滚动卡顿。单网络一次 44.418 ms 间隔,没有对应 >50 ms 长任务。其余 9 个样本没有 >25 ms 间隔。

冷打开仍未达标。下表是选择器/新钱包页面打开的三轮结果,不是完整应用进程冷启动

环境 最大 rAF 间隔,三轮(ms) 最大单次 JS 长任务,三轮(ms)
iOS Debug 231.67 / 273.74 / 269.83 141.96 / 273.22 / 203.63
Android Debug 159.28 / 146.03 / 216.48 155.78 / 145.91 / 200.93
Desktop 开发版 99.60 / 99.70 / 83.30 112.00 / 105.00 / 99.00

Desktop 生产版的弹窗打开/三个新钱包切换,在约 81.8 / 96.6 / 85.4 / 76.1 ms 的首个成功检查点达到可见头像、目标账户及相应金额就绪;检查间隔为 100 ms。最大帧间隔为 42.0 / 40.9 / 32.7 / 33.4 ms,前两个样本各有一个 50 ms 长任务。弹窗此前已预热;新钱包的服务构建次数事前为 0,但未事前检查这些头像磁盘键,因此不能宣称进程冷启动或磁盘冷缓存通过。记录的 15 条控制台错误均独立对应不支持的 sentry-ipc URL scheme,报告保留 MEASURED_WITH_CONSOLE_ERRORS 状态,未将其直接认定为 50 ms 长任务原因。

闪烁、像素和内存结果:

项目 实测结果 限制
Desktop 连续滚动头像 1200 / 6500 CSS px/s 各 3 次,共 5318 帧;头像未就绪、已就绪后丢失、重新进入空白、行间缺口、图片错误均 0 六个钱包在进入前分别核对 1000 个头像磁盘键,均不存在;进入后允许首屏就绪并等待 1 秒,允许有界预加载。是 DOM/图片状态检测,不是逐帧光栅或任意冷索引跳转保证
头像像素一致性,早期 URI 迁移证据 iOS 1014 seeds、Android 1227 seeds、Chrome Worker 1011 seeds 与 V1 均 0 RGBA 差异;设备缓存图片 iOS/Android 各 20 张也为 0 差异 证明对应头像生成与缓存内容,不替代整页 V1/V2 对比;生成算法未变
Desktop 六个千账户钱包开关与 GC renderer JS 堆 177.960 → 180.326 MiB,恢复后净增 2.366 MiB;六次关闭状态 DOM 都为 3174 短测未发现关闭后 DOM 持续增长,不能证明长期无泄漏;不含 Worker、图片解码、GPU、原生进程
缓存容量 accSelList 最多 3 个上下文 / 6 Mi 序列化字符;Web 头像磁盘预算 2048 项 / 32 MiB,待写队列 32 项 / 4 MiB 钱包/网络/派生组合是一个上下文;序列化字符不是堆内存字节。内存 Blob URL 目标 128 项,活跃引用受保护可超出目标;容量限制不等于测得内存下降

剩余卡点已分别记录,尚未关闭:

  1. Android main JS 运行时 SWR 整表处理:独立原生采样中,一个 224.894 ms 准备长任务的 22 个采样点全部位于 SWR flush 路径,包括反复 parse/prune/serialize 和后续 RPC;滚动中的 66.748 ms 帧间隔有 4 个采样点,3 个位于后台回执触发的整表处理。67 ms 是帧间隔,不是测得的同长度单次长任务。共享存储层修复方案已审计,尚未实施/验收,也不能据此把此前未采样的 213 ms 和 iOS 70 ms 精确归因。
  2. iOS 的 70 ms 账户间隔、各端冷打开及生产 Desktop 的 50 ms 长任务仍需继续定位。Desktop 开发版单独 CPU 采样识别到 React DEV 挂载/调用栈构建和 debug 同步 IPC 成本,但不能拿开发版栈直接解释生产版。
  3. 安装版 extension、Release 真机、compositor/panel 呈现、任意冷索引跳转、生产 Desktop 网络列表/连续头像/内存/进程冷启动尚未完成对应验收;这些结果不支持“三端全场景满帧”或“无内存泄漏”的结论。

可复用能力包括 NativeList 虚拟化、稳定 key/增量更新、图片调度、索引手势与 Cell 复用。余额聚合、账户格式化、网络选择计算、账户缓存容量属于选择器业务优化;其他业务可继续复用通用列表,而不依赖钱包服务。

校验及构建来源:账户/网络聚焦测试 18 + 10 通过;file-Worker 启动的 8 个行为分别验证 src/lib,既有 9 个调度测试、严格 TypeScript、207 文件 pristine patch 重放通过;提交检查通过。原生构建曾因 web-embed OCI 404 使用本地回退,不能称为干净的远程缓存命中。生产 renderer 构建 7863b1f557b28d0a 为 0 errors / 16 既有 warnings,26 项入口脚本 SRI 通过。

原生/开发版后续样本保留 52fdb1bbee 及 NativeList patch 0648ad80…f5f1 的来源;生产 renderer 使用 app source 105e3f8c99 加 patch cc47d171…b4bf,该补丁仅改变 Web avatar broker 的 src/lib,原生与生成器代码未变。远端之后合入 x2bc29eac64),当前报告提交为 3b151d7fd3;不能将此前实测重标为最后合入后的整分支运行时验收。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant