Skip to content

[Performance][Character Storage] pending削除ID取得がUserDefaults全キーを毎回走査する #481

Closed

Description

@shirokuma-xv

概要

pendingIDs() は dictionaryRepresentation().keys 全体を取得してからprefixを検索します。

根拠

KizunaAI/AI/CharacterLibrary/Repository/CharacterRepository.swift:82-88

問題

削除処理のたびに、Kizunaと無関係なUserDefaultsキーを含む全体走査が発生します。保存項目が増えるほど起動/再試行処理が遅くなります。

期待

pending IDの一覧を専用のCodable集合として保存し、読み取り対象を1キーに限定する。

テスト

大量のUserDefaultsキーを用意し、pending取得が無関係なキー数に比例して悪化しないことを測定する。

Activity

  1. viuk-issue-summarizer commented on Aug 21, 2026

    @viuk-issue-summarizer

    Model not found: opencode/deepseek-v4-flash-free. Did you mean: deepseek-v4-flash, deepseek-v4-pro, gemini-3-flash?

    github run

  2. shirokuma-xv commented on Aug 21, 2026

    @shirokuma-xv
    ContributorAuthor

    Fixed in merged PR #475 (merge commit 8eb404c). CharacterDeletionCleanupMarker now stores pending IDs in the dedicated Codable/string-array index and only performs the legacy UserDefaults scan once. Regression test: testCharacterDeletionMarkersCompactOldTombstonesAndIndexPendingIDs. The original PR used a combined Fixes #480/#481 reference, so this issue was not auto-closed.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions