Skip to content

Make neighbor preloading budget-aware and evaluate a smaller cache default #88

Description

@TheRealShek

What problem would this solve?

Neighbor images are fully decoded even when cache-budget-mb=0, then immediately evicted. Budget enforcement happens after allocation, so a retention limit does not prevent avoidable decode work or transient allocations.

After opening b and repeating a→c→b ten times among three 4000×3000 JPEGs:

Neighbor budget Settled PSS after 30 opens
256 MiB (default) 193.5 MiB
64 MiB 125.3 MiB
0 MiB 125.5 MiB

This sequence shows approximately 68 MiB / 35% lower PSS with smaller budgets. Fresh unviewed-neighbor runs were about 124 MiB for all three budgets, so cold PSS alone misses the effect of displaying cached images. A 64 MiB budget churns its one extra 12 MP slot in this sequence; results do not generalize to every navigation pattern.

What should open-mpv do?

Skip speculative decoding entirely at zero budget. For nonzero budgets, evaluate conservative admission based on frame metadata and checked byte reservations before expensive decoding. Keep foreground work prioritized and existing concurrency/cancellation bounds intact.

Compare a 64 MiB default and directional one-neighbor preloading against the current policy before choosing a default.

Acceptance checks:

  • Zero-budget logs show no neighbor decode starts.
  • Measure settled/peak PSS and cold/cached navigation latency across small, 12 MP and oversized images.
  • Preserve the documented cached-neighbor latency target and bounded scheduler behavior.
  • Update configuration docs/tests and matching requirements if defaults or semantics change.

Is there another way to solve it?

A lower retention budget alone helps warmed browsing but still permits decode-and-discard work. Retaining the existing default remains an option if measured navigation tradeoffs justify it.

Anything else?

Code: schedule_decodes, cache admission/eviction. Related completed work: #22 and #53. This extends byte admission without replacing the established scheduler.

Benchmark: 2026-09-13, optimized release commit ba3cd06 (cargo build --release --locked passed), Fedora 44 GNOME/Wayland, GTK 4.22.4, GStreamer 1.28.7, GSK_RENDERER=gl. Intel Alder Lake iGPU + NVIDIA RTX 3060 Mobile; video selected Intel vavp8dec. PSS includes the app and recursive decoder children, sampled from /proc/PID/smaps_rollup about every 100 ms. Fresh-launch values are medians of three 8-second runs, using seconds 5–8; peaks are sampled maxima. Transition results use one process per budget and are exploratory. MiB means 1,048,576 bytes. Synthetic gradient JPEGs and a 1080p30 VP8 test video were used; filesystem caches were not flushed. PSS does not fully account for GPU memory. No optimization has been implemented yet.

Before submitting

  • I searched for an existing issue about this idea.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    improvementImprove existing behavior, performance, or resource use

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions