@remotion/web-renderer: Skip very compressed transforms for performance#6202
Merged
JonnyBurger merged 1 commit intomainfrom Jan 3, 2026
Merged
@remotion/web-renderer: Skip very compressed transforms for performance#6202JonnyBurger merged 1 commit intomainfrom
@remotion/web-renderer: Skip very compressed transforms for performance#6202JonnyBurger merged 1 commit intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a performance optimization to handle extremely compressed transforms in the web renderer. When transforms compress an axis to near-zero scale (e.g., rotating 89.96° around the X-axis), the inverse matrix calculation can become numerically unstable or explode, causing performance issues. The PR detects these cases early and returns an empty rect, avoiding unnecessary computation for nearly invisible content.
Key Changes
- Added compression detection logic that checks if any axis is compressed below 1/100 of original scale
- Added comprehensive test case with many layers containing complex 3D transforms
- Early return for compressed transforms prevents expensive matrix inversions
Reviewed changes
Copilot reviewed 4 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
packages/web-renderer/src/drawing/get-pretransform-rect.ts |
Added scale factor checking to detect and skip very compressed transforms |
packages/web-renderer/src/test/many-layers.test.tsx |
New test case for rendering performance with many layers |
packages/web-renderer/src/test/fixtures/many-layers.tsx |
Test fixture with complex nested transforms and multiple layers |
packages/web-renderer/src/test/Root.tsx |
Registered new test composition in the root component |
packages/web-renderer/src/test/__screenshots__/* |
Screenshot baseline files for visual regression testing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.