Skip to content

(Performance) Avoid reloading replays on every ghost picker interaction - #510

Open
KrishRVH wants to merge 1 commit into
Balatro-Multiplayer:devfrom
KrishRVH:perf/cache-ghost-replay-picker
Open

(Performance) Avoid reloading replays on every ghost picker interaction#510
KrishRVH wants to merge 1 commit into
Balatro-Multiplayer:devfrom
KrishRVH:perf/cache-ghost-replay-picker

Conversation

@KrishRVH

@KrishRVH KrishRVH commented Jul 26, 2026

Copy link
Copy Markdown

Selecting a replay or flipping perspective rebuilds the ghost picker overlay. That rebuild currently calls
load_all_replays() again, synchronously rescanning both replay directories, rereading and parsing logs, decoding JSON
replays, and sorting the merged list.

This change keeps the parsed list for one picker session. Preview and flip rebuilds reuse it; reopening the picker loads
a fresh snapshot. Back, Clear Replay, and Play Match release the cached list.

For N preview/flip interactions, replay loading drops from N + 1 complete passes to one.

Verification

  • Added test_ghost_replay_picker_cache.lua, which checks one load per session and a fresh load after reopening.
  • Replay-log and serialization tests pass.
  • StyLua, Lua syntax checks, git diff --check pass for the changed files.

The existing test_ruleset_shape.lua harness still fails before its assertions because CardArea is not stubbed; that
path is unrelated to this change.

@KrishRVH KrishRVH changed the title Avoid reloading replays on every ghost picker interaction (Performance) Avoid reloading replays on every ghost picker interaction Jul 26, 2026
@KrishRVH
KrishRVH force-pushed the perf/cache-ghost-replay-picker branch from e52f52a to 8db88da Compare July 26, 2026 09:11
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.

1 participant