Repository navigation
Leaner idle, heap and startup; lists that don't shrink on errors - #10
Merged
Merged
Conversation
…shrink on errors - No 15 s session health timer: a lost connection is noticed on the next key, event or second of playback. Idle wakeups drop from ~15 to ~3 a minute (what's left is Spotify's own keepalive), and paused from ~12 to ~3 a minute. - A fixed glibc mmap threshold: each decoded cover raised the trim threshold, leaving ~7 MB of free heap resident. PSS after a few song changes: 28.9 MB -> 20.8 MB. - Smart-shuffle picks live in their own list instead of a copy of the whole playing list (-1.6 MB of heap with Liked Songs playing). - Terminals that don't answer the image query (tmux, ConPTY) are remembered for a week, so the first frame doesn't wait the 0.5 s timeout: 542 ms -> ~50 ms in tmux. - A metadata request or page that still fails after librespot's retries fails the load, instead of dropping those songs and saving the shorter list over the good copy. A failed refresh says the saved copy is showing. - Offline at start: say so and keep the saved login, instead of opening a browser login. - opt-level "s": the binary goes from 9.1 MB to 6.5 MB and PSS by ~2 MB, with no measurable change in CPU, cover decoding or key-to-frame time.
This was referenced Nov 24, 2026
Merged
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.
Efficiency pass, measured on a release build against a scratch copy of a real config/cache (Liked Songs: 3,953 songs, 110 playlists), Soloist backend, in tmux at 140×42. PSS from
/proc/<pid>/smaps_rollup, wakeups = voluntary context switches over all threads.What changed
session.is_invalid()interval is gone. A dead connection is noticed (and reconnected, at most every 15 s) on the next key, event or 1 Hz playback tick. The wakeups left while idle are librespot answering Spotify's keepalive ping, about one round per minute.malloc_trimcouldn't hand that memory back (seen inmalloc_info: 7.0 of 7.08 MB free, all in the top chunk). SettingM_MMAP_THRESHOLDonce at start fixes the threshold. I also tried trimming inside the decode thread: no effect, so it isn't included.recslist.~/.cache/trill/silent_terminals(keyed by TERM, TERM_PROGRAM, tmux and the terminal-specific env vars, re-asked after a week). The next start builds the same fallback picker the timeout would have given.ext_metaturned a failed request into an empty map, andcontext_tracksskipped a failed page. Both silently dropped songs, and the shorter list was saved over the good disk copy. Failures now propagate: the copy on screen stays, and the status says it's the saved one.--debug-tint, 12 covers), re-sorting 3,953 rows and key-to-frame were the same within noise (10–19 ms both ways, mostly tmux polling).Looked at, not changed
RowwithBox<str>would go from 168 to 128 bytes, ~160 KB on 4k songs. That's under 1% of PSS, so it's not worth the churn.Tested
cargo test,cargo clippy(0 warnings).w, sort cycling, offline start (unshare -rn).