Skip to content
Background loop: the 473-layer test film playing from the cache inside the Mootionblue editor, recorded on our staging build

How we keep a pro motion editor from freezing your browser

Workers, memory budgets and caching that steps aside for input. Plus six performance bugs that got through anyway, and what we changed.

Samrat Chowdhury, founder of MootionblueSamrat Chowdhury11 min read

Mootionblue is a motion editor that runs in your browser. No install, no plugin. Everything you see in the viewer, the browser draws: 473 layers in our main test film, 639 in our heaviest one.913

A browser tab gives you one thread for the interface. If that thread stalls, the tab stops answering clicks, the playhead stutters, and on a bad day the browser asks if you want to kill the page.

Why does a browser tab freeze?

The page’s main thread runs page JavaScript, handles input, and does style, layout and paint work; other browser threads also help with rendering.5

A click that arrives during a 300 ms main-thread task waits for the rest of that task, and maybe longer for other queued work.5

The browser gives you about 16.7 ms per frame at 60 Hz5. The spec for long tasks draws its line at 50 ms6. Usability research puts “feels instant” at about a tenth of a second1.

Our own bar is stricter: an edit should show up within one or two frames.

The basics: what we moved off the main thread

Workers are background threads the browser gives every page. The spec describes them as scripts “not interrupted by scripts that respond to clicks”4. We give them four jobs:9

  • Rendering for the cache. A worker draws frames on its own canvas, compresses them and stores them on disk inside your browser.21
  • Playback. A presentation worker decodes cached frames and draws them on the viewer canvas transferred to it. It sends frame-shown acknowledgements to the main thread.19
  • Working out what an edit touched. Where supported, a separate worker writes out the chunk labels, keeping that work off the main thread.
  • Audio effects and metering run in an audio worklet, on the browser’s audio thread.20

Workers draw the cached preview; the main thread handles input

The interface receives input and frame-shown acknowledgements. Separate workers render, store and present cached frames; audio uses its own worklet.

Illustrative thread map, not a timing trace. Chunk-label serialization uses a worker where supported. The audio worklet runs on the audio thread.

Data and sources
Workers draw the cached preview; the main thread handles input
GroupMeasureValueContext
Main threadInterface + input—Handles the editor interface and input.
Main threadReceives acknowledgements—Receives frame-shown messages from the presentation worker.
Cache render workerDraws—Renders on its own canvas.
Cache render workerCompresses—Compresses cached frames.
Cache render workerWrites to disk—Stores frames in browser-managed on-disk storage (OPFS).
Presentation workerDecodes—Decodes cached frames.
Presentation workerDraws viewer—Draws onto the transferred viewer canvas.
Presentation workerAcknowledges—Sends a frame-shown acknowledgement to the main thread.
Chunk-label workerWrites chunk labels—Serializes chunk labels on the supported worker path.
Audio threadAudio worklet—Runs audio effects and metering on the audio thread.
Thread map; acknowledgements are messages, not screen timing.

WebGL can also lose a page’s drawing context while managing power or memory8. Our rendering code listens for context or device loss, stops affected work and has paths to restore or recreate it. These reports did not test recovery end to end.

Illustrative only. Moving a canvas into a worker takes four lines. Making everything around it fast took the rounds below.19

offscreen.ts
// The canvas lives in a worker. The page only shows the result.
const view = canvas.transferControlToOffscreen();
const renderer = new Worker(rendererUrl, { type: "module" });
renderer.postMessage({ view }, [view]);
Illustrative worker-canvas setup.

Memory and input

The preview cache has a 384 MiB budget: 256 MiB for decoded frames, 64 MiB for drawing and 64 MiB of scratch. That’s the cache’s own accounting, not a cap on total browser or GPU memory.9

And input wins: pointer presses and non-modifier keys request a pause, and automatic filling can resume after 300 ms without input, once the pointer is released.9

Filling is paced, too. Normally it requests a 4 ms work budget and a 1 ms delay.9

If the browser reports four logical processors or fewer, a device-memory hint of 4 or less7, or an unplugged battery at 20 % or below, it requests 1 ms and 16 ms. Device hints may be unavailable.9

An animation-callback gap over 25 ms, or a task of at least 50 ms, triggers pressure pacing for five seconds.9

Newly opened project. The cache starts at 0 % and fills while you pause. Press play and it plays the frames that are ready.

The Mootionblue editor with the Preview cache menu open on a freshly opened 12-second film: Auto quality at 960 by 540, 0 % ready, 1.2 MB stored, and the note that it fills while you pause and plays ready frames.
A newly opened project, before the cache fills.

1. The moving playhead dominated Layerize work

Symptom. Cached playback of the 473-layer film looked smooth by every number we had, with a rare late frame we couldn’t explain.10

Clue. We traced 15 seconds of that playback. About 3.75 seconds of it was native compositing work on the main thread, in a step the trace calls Layerize.

Cause. Our playhead wrote a new inline transform on every tick. When we froze it in place and changed nothing else, compositing fell to 54.5 ms per 15 s.

What didn’t help. Promoting the timeline to its own layer: 3,827 ms. Using the separate translate property: 3,799 ms. Removing the playhead’s glow: 3,764 ms.

Moving playhead: 3,753 ms of Layerize work fell to 59 ms per 15 s

Three rejected moving-playhead variants stayed near the original cost. The paused-animation clock fix kept the playhead moving.

Local production build, Apple M1 Max, 473-layer film at Half. Native Layerize time per 15 s in single traced plays, not a repeated-trial median or physical screen latency.

Rounded labels; exact original, frozen and fixed values are 3,752.921, 54.522 and 59.378 ms.

Data and sources
Moving playhead: 3,753 ms of Layerize work fell to 59 ms per 15 s
GroupMeasureValueContext
Native Layerize timeOriginal · inline transform · Original3,753 msSingle traced play; exact 3,752.921 ms.
Native Layerize timeTimeline on its own layer · Rejected3,827 msRejected diagnostic variant.
Native Layerize timeSeparate translate property · Rejected3,799 msRejected diagnostic variant.
Native Layerize timePlayhead glow removed · Rejected3,764 msRejected diagnostic variant.
Native Layerize timePlayhead frozen · Diagnostic54.5 msDiagnostic only; exact 54.522 ms.
Native Layerize timeClock fix · playhead moving · Fix59 msPaused animation with its clock moved; exact 59.378 ms.
Native Layerize time per 15 s; the frozen playhead is a diagnostic.

Fix. We now create one paused animation that spans the ruler and only move its clock. The playhead lands on exactly the same pixel as before. In the production-fix trace, with the playhead moving, the browser spent 59 ms per 15 s on it.

Illustrative only. Same positions, same clock. The browser gets an animation to sample instead of a style to recompute.

playhead.ts
// Before: a style write on every tick.
playhead.style.transform = `translateX(${x}px)`;

// After: one paused animation across the ruler. Each tick only moves its clock.
const run = playhead.animate(
  [{ transform: "translateX(0px)" }, { transform: `translateX(${width}px)` }],
  { duration: width, fill: "both" },
);
run.pause();
run.currentTime = x;
Illustrative playhead animation.

Illustration: the bars spread each trace’s total Layerize time evenly over 900 nominal frame intervals in 15 s. They are averages, not measurements of individual frames or the timing of this demo. Hover to scrub.

Interactive illustration of average Layerize work.
Moving playhead · production fix · per 15 s3,753 →59 ms▼ 98 %

Single traced plays · local production build · Apple M1 Max · 473-layer film at Half

In the comparison traces, that removed about 3.69 seconds of Layerize work per 15 s. But the diagnostic never reproduced the original rare 32 ms gap, so it established neither that gap’s cause nor its cure.

The suspect. Our heaviest project, 639 layers, fully cached. This screenshot shows the 639-layer project. The playhead cost comparison above was measured with the separate 473-layer film.

The Mootionblue editor at 100 % zoom with our heaviest test project, 639 layers, fully cached: the Preview cache menu reads 100 % ready and 71.7 MB stored, and the red playhead sits on the timeline below the viewer.
The 639-layer project, fully cached.

2. One build’s late gaps clustered near ten seconds

Symptom. On one build, every late frame in six cached plays of the 639-layer project landed between 9.9 and 10.9 seconds into the 15-second play.11

Clue. The worker posted its frames on time. The main thread picked two of those messages up 13.7 ms and 12.2 ms late, at 10.83 s and 10.96 s.

Cause. Both waits overlapped a major garbage collection (the browser’s memory clean-up) on the main thread: 17.8 ms as the heap fell from 138.5 to 98.3 MB, and 15.6 ms, from 125.2 to 98.5 MB.

Chrome’s collector also works in steps and on other threads, but these traced collections included main-thread pauses. Research says such pauses may be observable at 60 fps2, and V8’s own team describes the same jank3.

Fix, part one. A 10-second sample of steady playback estimated 7.29 MB of allocations, including status merging and the meter filtering its history. After fixes, a separate 10-second sample estimated 3.62 MB.

That sample then led us to remove promises and closures for each displayed frame, plus iterator allocations. We did not measure a final post-fix total.

Illustration of acknowledgement gaps. Each build combines two garbage-collection examples from separate traced plays. Initial clean-up times and durations come from those traces; bar heights, counts and drag results are simulated, not a recording of one play.

Interactive illustration of acknowledgement gaps.

Part two, because part one wasn’t enough. On the next build the late frames moved: two still overlapped clean-ups of 17.3 and 17.5 ms, now at 3.4 and 3.0 seconds. We never proved why the first build clustered at ten seconds.

The allocation samples got smaller, but these traces don’t show the collector running less often. And because live objects add to collection work, we looked at what memory was being kept, with a heap snapshot.

3. 15.8 MB of labels

Symptom. A heap snapshot (a picture of JavaScript heap memory) of the paused 639-layer project showed about 98.3 MB used, after its own garbage collection.12

Clue. The snapshot showed 25 strings holding 15,811,364 bytes, about a sixth of the heap. They were the labels for the film’s 25 chunks, each up to half a second long.

Each label spells out everything its chunk depends on, so a busy chunk gets a label a megabyte long.

Cause. The main thread kept the full labels to identify cache entries and to make disk-worker requests. That made them worth shrinking, though the snapshot alone doesn’t prove how much collection time they caused.

Fix. For large labels, the main thread now holds a compressed copy and the disk worker expands it, when compression APIs are available and the result is smaller. Otherwise the full label still works.

Expansion restores the exact full label before disk lookup, so the file-name input doesn’t change, and the compression change itself doesn’t invalidate existing cache entries. The worker keeps at most 64 expanded labels.

Illustration of 25 chunk labels. The total character counts come from the offline compression test; individual bar widths are synthetic. Pick a label to illustrate expansion in the disk worker.

Interactive illustration of chunk-label compression.
Label text · offline compression test15.80 M →0.89 M chars▼ 94 %

Offline test: 15,798,899 → 892,330 chars (0.89 M), all 25 round trips exact. Separate post-fix browser run: 879,050 chars (0.88 M).

All 24 cached plays on the final round 15 local build passed our frame guard. One honest gap: we haven’t taken a new heap snapshot or garbage-collection trace since this fix. Whether the clean-ups got shorter is the first thing we’ll measure next round.13

4. The fps badge lied, and the lie made it worse

Symptom. During cached playback the editor’s fps badge turned red and read 43, then 49, with the label “dropping”. The same plays, measured at the player, showed 59.99 and 60.05 fps with zero missing frames.13

Clue. Only Auto quality plays did it, 5 of 22 passing plays, and in each one Auto flipped its “quality lowered” flag.

Cause. The old badge rounded each frame’s timestamp into a roughly 16.7 ms slot and rejected distinct frames that shared a slot.

An offline test of 600 frames at 60 Hz, with alternating ±1 ms jitter around the half-slot boundaries, read 30 fps.

Auto used the same reading then, so the counting bug could trigger its quality-lowering flag.

Fix. The badge now counts each distinct frame, whatever slot its timestamp lands in. After the fix, 24 of 24 cached plays stayed green with no quality lowering.

Simulated timestamps illustrate how slot-based counting can merge distinct frames. Dashed boxes show merged samples. This simplified demo uses floor-based slots; the historical bug rounded timestamps and had additional duplicate guards. It does not run the editor’s player or Auto policy.

Interactive illustration of the badge’s frame counting.

We now test the meter with known input before anything is allowed to react to it.

5. Our screen-timing meters failed their controls

Symptom. Every playback timing number above comes from instrumentation inside the browser.14

Clue. We tried two methods and checked each against controls: plays where we already knew the answer.

Recording the screen slowed the player it was measuring. A control app ran at 60.0 fps on its own and 51.3 fps while recorded.

A meter built from the browser’s performance trace showed no material overhead in its control: median acknowledgement rates were 59.996 fps untraced and 60.000 fps traced.

But on two plays we knew were smooth, it reconstructed 25 and 28 long holds that never happened, and put 13 and 8 frames out of order.

Cause. Screen recording competes with the player for the machine. The trace meter rebuilds the screen’s timeline from events that weren’t made for that.

What we kept. A provisional guard, timed at the main thread:

gaps between frame-shown acknowledgements no greater than 29 ms, at least 58 acknowledgements in each sliding one-second window, a median rate of at least 59.5 fps, and no missing, skipped or backwards source frames.

It can’t see the glass, and our reports say so next to every result.

Top row: what played. Bottom row: what each method reported. Dashed boxes are holds the method saw. Pattern for illustration; numbers from our control runs.

Interactive timing-meter control illustration.

6. What a 4× CPU throttle misses

Symptom. In the round 14 local test, a 4× CPU throttle on the page’s main target stood in for slower hardware.15

Auto did not lower quality during that caching test. In our setup, the throttle didn’t change device hints or slow the workers and GPU.15

Cause. That setup stresses main-thread response only. It doesn’t model how worker, GPU or storage speed changes on a different laptop, so it can miss bottlenecks we still need to measure on real hardware.

Three execution lanes over three nominal frame intervals. The real-laptop view illustrates that more than the main thread can be slower; its equal 4× scale is hypothetical, not measured hardware behavior.

Interactive illustration of the throttle’s limits.
  • A finished frame waited for housekeeping. The playback worker posted “frame ready” only after it set up the next refill, about 10 ms of setup in the real traces.18

    Now the notice goes out first. A test that injects 14 ms of setup confirms it: 14 ms late before, on time after.18

  • 59 of 60 status updates said nothing new. The cache reported its status 60 times in 15 s of playback, and 59 reports matched the one before. It now publishes only changes. Each call took at most about 0.1 ms in that diagnostic.18
  • Cancelled work kept going. Editing requests cancellation of automatic filling. We found steps that resumed after an await and scheduled more work anyway. Now a cancelled step can’t schedule the next one.9
One-pixel nudge, full speed43 →14.9 ms▼ 65 %
Same nudge, browser 4× slowdown168 →59.8 ms▼ 64 %
Click on the ruler, 4× slowdown82 →26 ms▼ 68 %

473-layer film while caching · local production builds 3033195b → 8b12cf52 · Apple M1 Max · 3 tries each, medians · input to next animation callback, not edited-picture or screen latency · favorable percentages truncated

At full speed in that local test, the next animation callback ran within 16.7 ms on all three nudges: 14.9 ms median, 15.8 ms worst. The next live-frame publication took 203.5 ms median. Neither marks when a frame physically reached the screen.

Watch it on staging

Real time, staging build. The 473-layer film caches all 740 frames, 18.9 s in this take with screen recording running, then plays straight from the cache.16

Clean view of the timeline film playing in the editor; play to watch the real-time staging cache test.
0:00
−0:37
Real time, staging build.
The 473-layer test film on our staging build at Half quality, paused on a glowing pause button: the Preview cache menu reads 100 % ready, 64.1 MB stored, and a green line under the timeline ruler marks the cached range.
Cached on staging. 100 % ready, 64.1 MB on disk. The green line under the ruler is the cached range.

What isn’t solved yet?

  • No real slow laptop yet. Every slow-machine number in this post comes from the browser’s 4× setting. A real five-year-old laptop is the next test.15
  • Heavy films play slower before they’re cached. In the paired local traces at Half quality and 100 % viewer zoom, the 473-layer film averaged about 26–28 fps live. The final round 15 cached cohort averaged about 60 acknowledged frames per second.1318
  • Main-thread collections delayed acknowledgements. Earlier diagnostics recorded 14–31 ms waits from worker post to main-thread handling, overlapping major garbage collection.1113

    No gap exceeded 29 ms in the final 24 local cached plays. Separating timing observation from main-thread delays remains a proposed follow-up, not a shipped fix.1113

  • Everything here was measured on one Mac. The application runs used one Apple M1 Max with a ProMotion display configured up to 120 Hz. The performance rounds were local production builds; the recording and identified staging screenshots are separate evidence.
  • Later staging found more. Candidate 8.7 staging found a mixed live/cache badge bug. Candidate 8.7.1 then passed the full- and partial-cache badge checks, but a cached play failed the 29 ms acknowledgement guard.17

    Live playback also fell below the paired round 14 baseline, and the cache-fill CPU comparison remained incomplete.17

Further reading

Cache design and editing while it caches cover the background to these fixes.

Sources

Our own measurements come from performance rounds 11–15, candidate 8.5 staging and the separately documented staging recording. The later status update also uses the candidate 8.7 and 8.7.1 staging results.

The Mootionblue reports below are internal test records, not public downloads. They identify the historical build, setup and signal behind each result. The diagrams and code examples are illustrative.

  1. Jakob Nielsen. “Response Times: The 3 Important Limits.” Nielsen Norman Group, 1993 (from Usability Engineering). www.nngroup.com/articles/response-times-3-important-limits.

    The first numbered limit.

  2. Ulan Degenbaev, Jochen Eisinger, Manfred Ernst, Ross McIlroy, Hannes Payer. “Idle Time Garbage Collection Scheduling.” PLDI ’16, ACM, 2016, pp. 570–583. research.google/pubs/pub45361. DOI 10.1145/2908080.2908106.

    Abstract, p. 570; §1.

  3. Peter Marshall. “Trash talk: the Orinoco garbage collector.” V8 blog, 2019. v8.dev/blog/trash-talk.

    “Orinoco” section.

  4. WHATWG. “HTML Living Standard, §10.1.1 Web workers: Scope.” WHATWG, living standard. html.spec.whatwg.org/multipage/workers.html.

    §10.1.1 Web workers: Scope.

  5. WHATWG. “HTML Living Standard, §8.1.7.3 Event loop processing model.” WHATWG, living standard. html.spec.whatwg.org/multipage/webappapis.html.

    Rendering opportunity note and update-the-rendering steps.

  6. W3C Web Performance Working Group. “Long Tasks API, §2 Terminology.” W3C Editor’s Draft. w3c.github.io/longtasks.

    §2 Terminology.

  7. WHATWG. “HTML Living Standard, §10.2.7 Concurrent hardware capabilities.” WHATWG, living standard. html.spec.whatwg.org/multipage/workers.html.

    Concurrent hardware capabilities.

  8. Khronos Group. “WebGL Specification 1.0, WebGLContextAttributes: powerPreference.” Khronos Editor’s Draft. registry.khronos.org/webgl/specs/latest/1.0.

    WebGLContextAttributes: powerPreference.

  9. Mootionblue. Candidate 8.7.1 implementation review, 24 October 2026, commit 2009c8ef.

    Browser rendering, workers and audio worklet; 384 MiB cache accounting; input pause, pacing, chunk identity and compression. Implementation evidence is separate from performance measurements.

  10. Mootionblue. Round 15 local report (R15-REPORT.md), 24 October 2026, playhead attribution and production-fix trace.

    473-layer Film, Half: 3752.921 ms Layerize baseline; 54.522 ms frozen diagnostic; 59.378 ms moving production fix. Rejected promotion, translate and shadow variants are in the same attribution record.

  11. Mootionblue. Round 15 local report (R15-REPORT.md), 24 October 2026, garbage-collection and allocation diagnostics.

    Six-play cohort 23a90c7e and separate traced plays on 23a90c7e / 8ccb9824; GC overlap and message delays; 7.29 MB and 3.62 MB separate ten-second allocation samples. Neither establishes final collection frequency.

  12. Mootionblue. Round 15 local report (R15-REPORT.md), 24 October 2026, paused heap snapshot and compact-key offline test.

    Studio 639: 98.3 MB after snapshot GC, 25 strings / 15,811,364 bytes. Offline: 15,798,899 → 892,330 characters and 25 exact round trips. Final browser run: 879,050 characters. These are separate measurements.

  13. Mootionblue. Round 15 local report (R15-REPORT.md), 23–24 October 2026, badge regression and final acceptance, build 1bfbfad3.

    Historical 5-of-22 badge discrepancy, 600-frame jitter regression, and final 24 cached plays: no quality lowering, no missing/skipped/backwards frames and no ACK gap above 29 ms. Callback timing only.

  14. Mootionblue. Round 15 local report (R15-REPORT.md), 23 October 2026, screen-recording and compositor-meter controls.

    Control app 60.0 → 51.3 fps while recorded; untraced / traced ACK medians 59.996 / 60.000 fps; erroneous reconstructed holds and frame order. Physical screen timing was not validated.

  15. Mootionblue. Round 14 and 15 local reports (R14-REPORT.md; R15-REPORT.md), 22–24 October 2026, paired input-response cohort, builds 3033195b → 8b12cf52.

    Three trials per condition on the M1 Max: 43 → 14.9 ms / 168 → 59.8 ms nudges; 82.2 → 25.8 ms ruler clicks.

    Input to animation callback; next live-frame publication was 203.5 ms median. Main-target 4× did not throttle workers or GPU.

  16. Mootionblue. Staging recording notes, “X · 16 · Caching pipeline · staging test.md”, documented by the 24 October 2026 blog review.

    Separate real-time staging recording: 473 layers / 740 frames, 18.9 s fill in this take with recording running; screenshot shows 100 % ready / 64.1 MB.

    Candidate 8.6 was identified by the lead; an exact recording-build commit was not supplied. It is not the candidate 8.5 timing cohort.

  17. Mootionblue. Candidate 8.7 and 8.7.1 staging reports (C87-STAGING-REPORT.md; C871-STAGING-REPORT.md), 24 October 2026.

    Mixed live/cache badge failure, later full/partial-cache badge passes, 33.1 ms ACK failure against the 29 ms guard, paired live regression and incomplete fill-CPU comparison. These staging results are separate from local round 15 acceptance.

  18. Mootionblue. Round 15 local report (R15-REPORT.md), 24 October 2026, frame-notification regression and status diagnostics.

    About 10 ms refill setup in traces; injected 14 ms regression; 60 status calls / 59 repeats in 15 s, maximum about 0.1 ms per call; cancellation fences. Paired live controls at Half / 100 % zoom measured about 26–28 fps.

  19. WHATWG. HTML Living Standard, OffscreenCanvas interface.

    Canvas transfer and worker drawing. Accessed 25 October 2026.

  20. W3C. Web Audio API, AudioWorklet.

    Audio processing on the audio rendering thread, separate from main-thread playback timing. Accessed 25 October 2026.

  21. MDN. Origin private file system.

    Browser-managed storage and clearing site data; cached previews remain disposable. Accessed 25 October 2026.

Samrat Chowdhury, founder of MootionblueSamrat Chowdhury

Mootionblue is in private beta. Join the waitlist and we’ll send you an invite as soon as there’s room.

No spam. One email when your invite is ready.