Skip to content

perf(spicetify-splash): leave sooner and snapshot the theme when idle - #47

Merged
afonsojramos merged 2 commits into
mainfrom
perf/splash-idle-snapshot
Oct 1, 2026
Merged

afonsojramos merged 2 commits into
mainfrom
perf/splash-idle-snapshot

Conversation

@afonsojramos

@afonsojramos afonsojramos commented Oct 1, 2026 •

Copy link
Copy Markdown
Member

Summary

Splash now leaves sooner once the client is ready, and no longer blocks the main thread as it goes.

  • Readiness check. Readiness is checked every 25 ms instead of every 100 ms.
  • Fade-out. The default fade-out is 250 ms instead of 450 ms. Themes can still set --splash-exit-duration, and the README table reflects the new default.
  • Theme snapshot. Recording the theme snapshot used to read computed custom properties synchronously as the splash left. The first getPropertyValue forced a full style recalculation, about 52 ms in a CPU profile of a cold boot. The snapshot now runs in requestIdleCallback, with a 5 s timeout, falling back to setTimeout where idle callbacks are unavailable.

Bumps spicetify-splash to 0.1.1.

Results

Spotify 1.3.3.264, macOS arm64, 19 modules, using the startup CLI from spicetify/cli#4009 and stdlib from #48. The machine was under heavy unrelated load. The time from all modules loaded to the splash being gone went from about 715 ms (0.1.0, 12 boots) to about 380 ms (this branch, 8 boots).

Splash also delays the client's own boot. In an interleaved A/B (12 boots each), webpack capture came at 692 ms with Splash and 450 ms without. Emulating reduced motion, which turns the animations off, recovered about 90 ms of that. The rest could not be attributed reliably under this load.

Validation

  • All 16 splash tests pass. The readiness test now checks that the splash starts leaving within 25 ms and is removed 250 ms later.
  • pnpm run check and oxfmt --check pass.
  • Live: hot-pushed over the published 0.1.0. The boot→loading→leaving→app sequence completes, and the theme snapshot is still recorded.

@coderabbitai

coderabbitai Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 70053b0d-e58a-431f-9394-458bb828a02f

📥 Commits

Reviewing files that changed from the base of the PR and between a1dce15 and 3a48c0d.

📒 Files selected for processing (2)
  • modules/spicetify-splash/metadata.json
  • modules/spicetify-splash/splash.ts

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


Walkthrough

The dispose path now schedules theme snapshot saving through whenIdle. The helper uses requestIdleCallback with a 5-second timeout when available, or setTimeout with a 0 ms delay otherwise. The extension metadata version changes from 0.1.0 to 0.1.1.

Changes

Theme snapshot scheduling

Layer / File(s) Summary
Schedule theme snapshot saving
modules/spicetify-splash/splash.ts, modules/spicetify-splash/metadata.json
whenIdle schedules a callback with requestIdleCallback or a zero-delay timeout. dispose uses the helper to schedule saveThemeSnapshot when recordTheme is set. The metadata version changes to 0.1.1.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Refactor

Merge Risk: ⚪ Minimal · up to 3a48c

Theme snapshots are now saved after idle scheduling rather than during disposal. The inspected replacement paths show no concrete regression, so the change is mergeable on the available evidence, subject to normal checks.

Architecture Summary

Architecture risk: 🔵 Low · up to 3a48c

The change affects 1 system.

Changed systems: modules

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — modules (service) was modified; 2 changed files map to changed impact.

Before / after behavior

  • observed — Modified behavior in modules/spicetify-splash/metadata.json: The metadata version was updated from 0.1.0 to 0.1.1.
  • observed — Modified behavior in modules/spicetify-splash/splash.ts: dispose now schedules saveThemeSnapshot(CSS, customCss) through whenIdle instead of saving it immediately when recordTheme is set.
  • observed — Modified behavior in modules/spicetify-splash/splash.ts: Adds whenIdle, which uses requestIdleCallback with a 5-second timeout when available and otherwise schedules the callback with a 0 ms timeout.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 1 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: deferring theme snapshot recording until the client is idle to improve startup performance.
Full details: Docstring Coverage

Explanation

Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 1 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit waits while browsers rest,
Then saves the theme at idle’s best.
A timeout helps when idle’s away,
The snapshot finds its time to stay.
One small version hops ahead.

Comment @coderabbitai help to get the list of available commands.

@afonsojramos afonsojramos changed the title perf(spicetify-splash): record the theme snapshot when the client is idle perf(spicetify-splash): leave sooner and snapshot the theme when idle Oct 1, 2026
@afonsojramos
afonsojramos merged commit 23d9b79 into main Oct 1, 2026
6 checks passed
@afonsojramos
afonsojramos deleted the perf/splash-idle-snapshot branch October 1, 2026 23:03
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