perf(danmaku): 弹幕渲染优化 — 卸主线程+预缓存+预加载窗口#66
Merged
Conversation
added 2 commits
May 10, 2026 12:10
- getReleases() 原逻辑将 targetCommitish 与字符串 "develop" 直接比较, targetCommitish 实际存储的是 commit SHA,恒不匹配,导致 filter 永远返回空 - 新增 getAllReleases() 负责纯 API 拉取,getBranchHeadSha() 解析分支 HEAD SHA - getReleases() 改用与 getBranchHeadSha(CURRENT_BRANCH) 的比较结果过滤 - 分支 HEAD SHA 解析失败时降级(不分支过滤),避免网络异常直接炸 - getLatestPreReleaseBuild() 加 page <= 10 上限防止极端情况无限循环
三处改动均针对 VideoPlayerV3ViewModel(单文件): 负载降低:loadDanmaku 将 XML 解析 + 10万条目映射 + groupBy 全量 移入 Dispatchers.Default,主线程只做一次 swapList(3万) + updateData(1次) 注释持久化:预备 milliSeconds 分段缓存直接存 Map<Long,List<DanmakuItemData>>,后续分段切分 map轉 value 从 dataList 的直接引用取得,不重 repeat 加载专精:loadDanmakuSegment 构建新 List 的工作全部迁到 Default,不与读写 切换空闲。updateDanmakuForPosition 预加载条件由 > 改为 >=,提前一整个地区 段(60s) 触发预读,边界前先于用户抵达即可。
f87ea00 to
3ab7b3a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
配合 PR f87ea00 同时完成一套弹幕渲染优化。