perf: 优化冷启动速度与渲染性能,修复多项体验问题 - #22
Merged
Merged
Conversation
1. 延迟初始化localforage实例,避免模块解析阻塞冷启动 2. 重构Electron初始化逻辑,按需异步加载模块并添加错误捕获 3. 实现播放队列懒加载,减少初始渲染资源占用 4. 优化封面取色逻辑:降低采样尺寸、添加缓存、调度到空闲帧执行 5. 重构Android播放上下文同步逻辑,添加脏数据守卫与错误处理 6. 拆分初始化非关键任务到启动后执行,缩短首屏渲染时间 7. 修复本地数据加载并发写入覆盖问题,优化数据加载逻辑 8. 移动全局markdown样式到对应组件,减少主bundle体积
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.
📌 变更类型
📝 变更说明
围绕冷启动到首播的关键路径与切歌时主线程阻塞做一组组合优化与对应 Bug 修复,主要包含:
性能优化
music-data/user-data/background-data三个 IndexedDB 实例改为按需懒加载(getMusicDB() / getUserDB() / getBackgroundDB()),避免模块解析阶段就建立 IDB 连接拖慢冷启动。initIpc/sendRegisterProtocol/useSettingStore改为按需import()异步加载,并加.catch错误捕获,确保 Android / Web 路径不再无谓加载 Electron 专属模块。SongPlayList抽屉用defineAsyncComponent+v-if="hasMountedPlayList"在用户首次打开时才挂载(先前的<Suspense>写法实际只拆 chunk 不延迟挂载),首挂载后保持常驻避免 n-drawer 入场动画重置。QuantizerCelebi.quantize工作量降至约 40%;requestIdleCallback中,避免阻塞切歌首帧渲染。Bug 修复 / 健壮性
awaitIPC 之间检查"歌曲是否还是初始那一首",无论是否传入songOverride都做守卫;用户在 await 间隙切歌时不再把旧歌的元数据 / 队列上下文写入 Native,并补上整体 try/catch 防御 IPC 异常。isLoadingData+dirtyMusicKeys/dirtyUserKeys脏标记机制,加载期间用户触发的 setPlayList 等写操作不会被随后到达的旧值getItem覆盖;async并await setItem,避免 fire-and-forget 在 App 后台时丢写。github-markdown-css/github-markdown.css引入,改为按使用组件局部加载,缩减主 bundle 体积。🔗 关联 Issue
Closes #
📱 影响范围
✅ 自检清单
devpnpm lint且无 warningpnpm typecheck且无报错🧪 测试方式
💬 其他说明 (选填)