Skip to content

Load card recognition when the video plays; free it after 10 idle minutes - #36

Merged
ryangswe merged 2 commits into
mainfrom
load-at-play
Nov 11, 2026
Merged

ryangswe merged 2 commits into
mainfrom
load-at-play

Conversation

@ryangswe

Copy link
Copy Markdown
Owner

Two behavior changes for 0.8.0, which hasn't been uploaded yet.

Load at play (7bc7256). The content script makes the compute frame, which loads the model, when the page's main video starts playing with card hovers on. If the video is already playing when hovers turn on, it loads at once. The first hover then usually meets a loaded model.

  • The tooltip frame still waits for the pointer, and nothing is analyzed before a hover.
  • A video that never plays loads on the first pointer move over its picture, as before.
  • Hovers off, pages with no video and installs load nothing.

Idle unload (33a6113). After 10 minutes with no move over the picture and no card showing, both frames are removed, which frees the model's memory.

  • The next pointer move anywhere in the page while the video plays reloads the model, and so does the video playing again after a pause.
  • A playing event with no pause first (a buffering stall, a loop, an ad) does not reload.
  • A dev build can shorten the idle time with --idle-unload-ms; other builds refuse the flag.

The privacy page and the docs now say the release download happens when a video plays. The settings refresh and the card details file still wait for a hover.

Measured on an Apple-silicon Mac (native Chrome for Testing 152, dev builds):

  • With no hover, a playing video costs about 320 MB of memory, and 1.5–2.2 CPU-seconds a minute while idle.
  • A hover after the load shows the card in 0.2–0.4 s, against 2.5 s when the load runs inside the hover.
  • After the unload, memory returns to within about 30 MB of having nothing loaded.
  • After an unload, moving the pointer across the page to a card shows it about 1.2 s after the first move.

Checks: 595 tests pass (type check and vitest), and lint is clean.

The content script makes the compute frame, which loads the model, when the
page's main video starts playing with card hovers on (or at once when it is
already playing as hovers turn on). The first hover then usually meets a
loaded session. The tooltip frame still waits for the pointer, nothing is
analyzed before it, and a video that never plays loads on the first pointer
move over its picture, as before. Hovers off, pages with no video and installs
still load nothing.

The privacy page and the docs say the release download now happens when a
video plays; the settings refresh and the details file still wait for a hover.

Signed-off-by: RDCLder <raymondyang.dev@gmail.com>
After IDLE_UNLOAD_MS (10 minutes) with no trusted move over the picture and
no card showing, the content script removes both frames, which frees the
model's memory. The next trusted pointer move anywhere in the page while the
video plays, or the video playing again after a pause, makes the compute frame
again, so the load runs while the pointer travels to the card. A `playing`
with no pause first (a stall, a loop) does not reload.

A dev build can shorten the idle time with --idle-unload-ms to check the
unload; other builds refuse the flag.

Signed-off-by: RDCLder <raymondyang.dev@gmail.com>
@ryangswe
ryangswe merged commit 9058775 into main Nov 11, 2026
5 checks passed
@ryangswe
ryangswe deleted the load-at-play branch November 11, 2026 04:56
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