Skip to content

Release Snoopy 1.1 with performance and lifecycle fixes - #2

Merged
Cyber-Yichen merged 2 commits into
mainfrom
perf-idle-lifecycle-test
Jul 21, 2026
Merged

Cyber-Yichen merged 2 commits into
mainfrom
perf-idle-lifecycle-test

Conversation

@Cyber-Yichen

Copy link
Copy Markdown
Owner

更新内容

  • 发布版本号更新为 1.1(内部构建号 2),并替换系统设置缩略图
  • 修复长时间运行后 IdleScene 卡顿、掉帧和高功耗问题
  • 增加每块显示器的活动实例协调,主动终止宿主残留的旧屏保实例
  • 完整清理 AVPlayer、AVPlayerLayer、观察者、转场中对象和后台任务
  • 将 HEIC 帧解码移出主线程,使用有限并发、请求取消、预取和有界缓存
  • 降低环境信息轮询频率
  • 补充中文与英文 README 的季节、时段和生日彩蛋预览

根因

macOS 墙纸宿主可能反复创建屏保视图而未及时回收旧实例,导致播放器和线程持续累积。同时,IdleScene 的 HEIC 序列此前在 Core Animation 提交阶段发生惰性解码,阻塞主线程并重复消耗 CPU。

用户影响

长时间运行时的风扇噪音、能源占用和 IdleScene 掉帧显著降低;屏保停止或被替换时会可靠释放播放器和图层资源。媒体资源仍保持本地,不包含在本仓库中。

验证

  • arm64 / x86_64 通用 .saver 构建通过
  • 代码签名结构验证通过(ad-hoc)
  • 25 个重复视图压力测试后仅保留 1 个活动实例
  • 主线程采样中不再出现 HEIF/ImageIO 解码
  • IdleScene 双次加载、半色调图层、角色无缝切换及 intro/loop/outro 冒烟测试通过
  • 12 轮 ActiveScene / IdleScene 强制转场后无残留根图层
  • 构建包启动与渲染冒烟测试通过
  • Git 跟踪文件中不含 MOV 或 HEIC 媒体

Copilot AI review requested due to automatic review settings July 21, 2026 07:18

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR prepares the Snoopy screen saver for the 1.1 release by addressing long-running performance/lifecycle problems (especially IdleScene HEIC decoding and stale instance accumulation in wallpaper mode) and improving teardown correctness.

Changes:

  • Replaces the old NSImage-based frame cache with a bounded, cancellable CGImage decode pipeline running off the main thread (with limited concurrency and prefetch).
  • Adds session lifecycle coordination to ensure only one active ScreenSaverView per display/preview and strengthens teardown/transition cleanup to prevent AVPlayer/CALayer residue.
  • Bumps CFBundleShortVersionString/CFBundleVersion to 1.1 (build 2).

Reviewed changes

Copilot reviewed 3 out of 5 changed files in this pull request and generated 1 comment.

File Description
Sources/SpritePlayer.swift Introduces FrameDecoder with off-main-thread HEIC thumbnail decoding + bounded cache; updates frame-sequence playback to request/prefetch decoded CGImages and improves cleanup.
Sources/ScreenSaverView.swift Adds per-display active instance coordination and a sessionActive lifecycle; improves transition retention and shutdown cleanup; reduces environment refresh frequency.
Info.plist Updates app version to 1.1 (build 2).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +437 to 445
private func activationKey() -> String {
if isPreview { return "preview" }
let screenNumberKey = NSDeviceDescriptionKey("NSScreenNumber")
if let number = window?.screen?.deviceDescription[screenNumberKey] as? NSNumber {
return "screen-\(number.stringValue)"
}
return "fullscreen"
}
}
@Cyber-Yichen
Cyber-Yichen marked this pull request as ready for review July 21, 2026 07:57
@Cyber-Yichen
Cyber-Yichen merged commit 4898b2d into main Jul 21, 2026
1 check passed
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.

2 participants