Skip to content

Clear queue using range removals instead of per-item loop - #230

Open
DarkPhoenix42 wants to merge 1 commit into
PixelPlayerHQ:mainfrom
DarkPhoenix42:perf/clear-queue-range-removal
Open

DarkPhoenix42 wants to merge 1 commit into
PixelPlayerHQ:mainfrom
DarkPhoenix42:perf/clear-queue-range-removal

Conversation

@DarkPhoenix42

Copy link
Copy Markdown

What changed

Clearing the playback queue when holding a large amount of songs (~450) took a few seconds and noticeably froze the UI. This was due to the clearing being done using a per-item removal loop which causes a lot of redundant IPC calls along with timeline recomputations in the player engine.

This change replaces the per-item removal loop with atmost two removeMediaItems() range calls, reducing the queue clearing time to a few milliseconds and eliminating the UI freeze.

Tests

  • ./gradlew :app:compileDebugKotlin :app:lintDebug :app:testDebugUnitTest passes
  • tested on motorola g54 5G (running PixelOS, Android 16)

Clearing the playback queue when holding a large amount of songs (~450)
took a few seconds and noticeably froze the UI. This was due to the
clearing being done using a per-item removal loop which causes a lot of
redundant IPC calls along with timeline recomputations in the player
engine.

This change replaces the per-item removal loop with atmost two
removeMediaItems() range calls, reducing the queue clearing time to a
few milliseconds and eliminating the UI freeze.
Copilot AI balanced review requested due to automatic review settings November 10, 2026 16:18

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@greptile-apps

greptile-apps Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] This change appears safe to merge.

Summary

clearQueueExceptCurrent() replaces the per-item loop with at most two removeMediaItems() calls.

  • Clearing the queue keeps the current song and removes the rest with up to two calls.

Reviews (1) · Last reviewed commit: "Clear queue using range removals instead..." · Reviewed by Greptile

@lostf1sh

Copy link
Copy Markdown
Collaborator

Will look into these prs as soon as possible, it's kinda busy since I got into a full time job, sorry about that.

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.

3 participants