Skip to content

perf: runtime optimizations across installer and launcher#6

Merged
aradanmn merged 3 commits intomainfrom
claude/add-black-box-quadrant-OuXKe
Apr 18, 2026
Merged

perf: runtime optimizations across installer and launcher#6
aradanmn merged 3 commits intomainfrom
claude/add-black-box-quadrant-OuXKe

Conversation

@aradanmn
Copy link
Copy Markdown
Owner

Summary

  • CurseForge token cache — token was downloaded + OpenSSL-decrypted on every call to any CurseForge function (up to 4×/run); now fetched once and reused from _CF_TOKEN_CACHE (~300–600ms saved per redundant fetch)
  • $(<file) bash builtin — replaced 4× cat "$tmp_body" with $(<"$tmp_body") to eliminate unnecessary subprocess forks
  • getScreenDimensions cache — was spawning xdpyinfo | grep | awk | cut (4 processes) on every window reposition event; cached in _SCREEN_DIMS_CACHE since resolution never changes mid-session
  • Main event loop subshell eliminatedactive=$(countActiveInstances) fired every second during gameplay; replaced with $CURRENT_PLAYER_COUNT which is already kept current by handleControllerChange and checkForExitedInstances
  • flatpak list cacheflatpak list --app (~0.5–1.5s) was called 2–3× per install run; now runs once and subsequent checks grep the cached string via _FLATPAK_LIST_CACHE

Test plan

  • Run installer end-to-end and verify CurseForge mods still resolve correctly
  • Verify flatpak list is only invoked once (check with strace or timing)
  • Launch dynamic splitscreen, join/leave players — confirm window repositioning still works and placeholder shows/hides correctly for 3-player layout
  • Confirm session exits cleanly when all players quit

https://claude.ai/code/session_0156HqbWenksACpkAbh83nix

claude added 3 commits April 17, 2026 23:55
mod_management.sh:
- Cache CurseForge API token after first download+decrypt — saves
  ~300-600ms × (N-1) calls per session (token was re-fetched up to
  4 times; now fetched once and reused from _CF_TOKEN_CACHE)
- Replace cat "$tmp_body" → $(<"$tmp_body") bash builtin at 4 sites —
  eliminates 4 cat subprocess forks per install run

launcher_script_generator.sh:
- Cache getScreenDimensions() result in _SCREEN_DIMS_CACHE — screen
  resolution never changes mid-session; was spawning xdpyinfo+grep+
  awk+cut (4 processes) on every window reposition event
- Main event loop: replace active=$(countActiveInstances) subshell
  with $CURRENT_PLAYER_COUNT — that variable is already kept current
  by handleControllerChange and checkForExitedInstances; eliminates
  1 subshell per second of gameplay
- updatePlaceholderWindow: same — read CURRENT_PLAYER_COUNT directly
  instead of spawning countActiveInstances subshell on every call

path_configuration.sh:
- Cache flatpak list --app output in _FLATPAK_LIST_CACHE — flatpak
  list takes ~0.5-1.5s; was called 2-3 times per install run; now
  runs once and greps the cached string on subsequent calls
- Consolidate inline flatpak list call in launcher_script_generator.sh
  to use is_flatpak_installed() so it benefits from the same cache

https://claude.ai/code/session_0156HqbWenksACpkAbh83nix
- launcher_script_generator.sh v3.2.12: move CURRENT_PLAYER_COUNT update
  to before updatePlaceholderWindow() in the scale-up path; the stale
  value (old count) caused updatePlaceholderWindow to always call
  hidePlaceholderWindow instead of showPlaceholderWindow when a 3rd
  player joined

- instance_creation.sh v3.0.2: set guiScale:4 (max) in generated
  options.txt so HUD elements are readable at TV-viewing distance;
  the default guiScale:0 (auto) picks a small scale for quarter-screen
  windows making text and icons too small from 16+ feet away

https://claude.ai/code/session_0156HqbWenksACpkAbh83nix
@aradanmn aradanmn merged commit c631792 into main Apr 18, 2026
@aradanmn aradanmn deleted the claude/add-black-box-quadrant-OuXKe branch April 18, 2026 20:19
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