Skip to content

perf(#270): artwork base64 が未変化ならデコード済み Data を再利用#274

Merged
GeneralD merged 4 commits into
mainfrom
perf/#270-artwork-base64-decode-cache
Jun 12, 2026
Merged

perf(#270): artwork base64 が未変化ならデコード済み Data を再利用#274
GeneralD merged 4 commits into
mainfrom
perf/#270-artwork-base64-decode-cache

Conversation

@GeneralD

@GeneralD GeneralD commented Jun 12, 2026

Copy link
Copy Markdown
Owner

type breaking scope diff files tests review estimate vs actual

Closes #270 (Part of #258)

概要

media-remote-helper はイベント毎にフルペイロードを再送するため、同一トラックの elapsed 更新でも高解像度アートワークの base64 フルデコードが毎回走っていた。直前のイベントの base64 文字列と比較し、一致時はデコード済み Data を再利用するメモ化を入れて、変化時のみデコードするようにした。

変更内容

  • MediaRemoteDataSourceImpl.artworkData(from:) を追加 — StreamStateBoxlastArtworkBase64 / lastArtworkData を持たせ、lock 保護下で比較・キャッシュする
  • デコード関数 decodeBase64 を init 注入に変更(public convenience init() は従来どおり Data(base64Encoded:) を使用)— テストでデコード呼び出し回数を検証可能にするため
  • テスト 3 本追加:
    • 同一 base64 が連続 → デコードは 1 回のみ、両イベントとも同じ Data を返す
    • base64 が変化 → 再デコードされる
    • artwork なしペイロード → デコーダは呼ばれない

補足

テスト

  • swift test 全 928 件パス
  • make format 適用済み

GeneralD added 2 commits June 12, 2026 12:10
media-remote-helper はイベント毎にフルペイロードを再送するため、同一
トラックの elapsed 更新でも高解像度アートワークのフルデコードが毎回
走っていた。直前の base64 文字列と比較し、一致時はデコード済み Data を
返すメモ化を StreamStateBox(lock 保護)に追加。デコード関数は init 注入
にしてテストで呼び出し回数を検証できるようにした。
Copilot AI review requested due to automatic review settings June 12, 2026 03:11
@GeneralD GeneralD self-assigned this Jun 12, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@GeneralD, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 47 minutes and 49 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more credits in the billing tab to continue.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f171491d-685c-4044-a028-b5f773fbbe38

📥 Commits

Reviewing files that changed from the base of the PR and between 70564c9 and e7b7c50.

📒 Files selected for processing (3)
  • Sources/MediaRemoteDataSource/MediaRemoteDataSourceImpl.swift
  • Sources/VersionHandler/Resources/version.txt
  • Tests/MediaRemoteDataSourceTests/MediaRemoteDataSourceImplTests.swift
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch perf/#270-artwork-base64-decode-cache

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov

codecov Bot commented Jun 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@GeneralD GeneralD merged commit 794b48f into main Jun 12, 2026
4 checks passed
@GeneralD GeneralD deleted the perf/#270-artwork-base64-decode-cache branch June 12, 2026 05:35
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.

perf: MediaRemote イベントの artwork base64 を変化時のみデコードする

2 participants