Skip to content

perf(thumbnail): optimize thumbnail generation using Blobs, Object URLs and batched state updates#718

Open
AdityaM-IITH wants to merge 1 commit into
magic-peach:mainfrom
AdityaM-IITH:fix/thumbnail-strip-performance
Open

perf(thumbnail): optimize thumbnail generation using Blobs, Object URLs and batched state updates#718
AdityaM-IITH wants to merge 1 commit into
magic-peach:mainfrom
AdityaM-IITH:fix/thumbnail-strip-performance

Conversation

@AdityaM-IITH
Copy link
Copy Markdown
Contributor

Overview

This PR introduces a significant performance overhaul to the video frame generation pipeline inside ThumbnailStrip.tsx. It eliminates severe client-side browser heap degradation (~1.8MB+ reduction over baseline video lengths) and aggressive quadratic DOM rendering cascades during asset ingestion.

Changes Executed

  • Binary Conversion Migration: Transitioned the canvas image capture mechanism from memory-heavy base64 string allocations (toDataURL()) to lightweight binary object pointers using canvas.toBlob().
  • Memory Lifecycle Management: Mapped extracted frames using temporary, lightweight Object URLs (URL.createObjectURL(blob)). Tracked active pointers inside a mutable objectUrlsRef and introduced an explicit clean-up hook utilizing URL.revokeObjectURL() during component unmounts or timeline resets to completely prevent memory leaks.
  • Render Cascade Throttling: Batched React state updates to trigger once every 5 frames and upon full sequence completion, eliminating aggressive DOM repaint thrashing and micro-stutters.

🎥 Local Verification Tape

  • UI & Pipeline Proof: Verified frame extraction stability and timeline rendering inside the editor workspace.
  • Compiler Validation: bunx tsc --noEmit and bun run lint pass flawlessly with zero type errors.
reframe.thumb.strip.mp4

Checklist

  • Local build and type-checks pass cleanly
  • Verified zero memory-leak regressions during repetitive asset tracking
  • Self-reviewed the diff

@vercel
Copy link
Copy Markdown

vercel Bot commented May 19, 2026

@AdityaM-IITH is attempting to deploy a commit to the magic-peach1's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions
Copy link
Copy Markdown
Contributor

👋 Thanks for your PR, @AdityaM-IITH!

Welcome to Reframe — a browser-based video editor built for everyone 🎬

What happens next

  1. 🤖 Automated checks — build & TypeScript typecheck will run automatically
  2. Vercel preview — a preview deployment will be created (requires maintainer authorization for fork PRs)
  3. 👀 Code review — a maintainer will review your changes
  4. 🚀 Merge — once approved, your PR will be merged!

Quick checklist

  • PR title follows Conventional Commits (e.g. feat: add dark mode)
  • Linked the issue this PR closes (e.g. Closes #123)
  • Tested the changes locally (bun run dev)
  • Build passes (bun run build)

Useful links

Happy coding! 🎉

@github-actions
Copy link
Copy Markdown
Contributor

⚠️ PR Format Issues — @AdityaM-IITH

Please fix the following before your PR can be reviewed:

  • ⚠️ No linked issue found. Add Closes #<issue-number> to your PR description.

Push new commits after fixing — this comment will update automatically.

📖 CONTRIBUTING.md

@github-actions github-actions Bot added level:beginner Beginner level - 20 pts type:design UI/UX design type:performance Performance type:refactor Code refactor labels May 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

level:beginner Beginner level - 20 pts type:design UI/UX design type:performance Performance type:refactor Code refactor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant