perf: runtime optimizations across installer and launcher#6
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
_CF_TOKEN_CACHE(~300–600ms saved per redundant fetch)$(<file)bash builtin — replaced 4×cat "$tmp_body"with$(<"$tmp_body")to eliminate unnecessary subprocess forksgetScreenDimensionscache — was spawningxdpyinfo | grep | awk | cut(4 processes) on every window reposition event; cached in_SCREEN_DIMS_CACHEsince resolution never changes mid-sessionactive=$(countActiveInstances)fired every second during gameplay; replaced with$CURRENT_PLAYER_COUNTwhich is already kept current byhandleControllerChangeandcheckForExitedInstancesflatpak listcache —flatpak 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_CACHETest plan
flatpak listis only invoked once (check withstraceor timing)https://claude.ai/code/session_0156HqbWenksACpkAbh83nix