---
title: "Video Editing SDK Best Practices | Rendley SDK Docs"
description: "Optimize Rendley SDK performance in production. Manage memory, speed up video rendering, handle large files and keep in-browser video editing smooth."
url: https://docs.rendley.com/sdk/best-practices/
---

# Best practices

Here are some best practices to achieve optimal performance with the SDK.

## Do not upload images for simple shapes

If you need a rectangle, circle, or any other basic shape, it is better to use the [Shape](https://docs.rendley.com/sdk/getting-started/clips/shape/) clip instead.

## Avoid calling `deserialize` to apply updates

Calling `deserialize` multiple times can initialize many internal resources unnecessarily. If you frequently apply updates using JSON, it is more efficient to identify the changes and apply them manually, or use [`Timeline.loadSerializedData`](https://docs.rendley.com/sdk/getting-started/timeline/#partial-deserialization) for partial updates.

## Check `isSafeToSerialize` before saving

The Library processes media asynchronously (transcoding, hashing, filmstrip, samples). Saving in the middle of this work produces incomplete JSON. Always gate saves on [`Engine.isSafeToSerialize()`](https://docs.rendley.com/sdk/getting-started/engine/#checking-readiness).

## Stream large exports, do not merge them in memory

For projects larger than 2GB enable [chunked output](https://docs.rendley.com/sdk/getting-started/export/#large-files-and-chunked-output) and stream the chunks straight to disk or network. Merging chunks in the browser hits the single-blob allocation limit.

## Prefer xxHash for large files

SHA-256 is slow on large inputs. For files larger than a few hundred MB, [switch to xxHash](https://docs.rendley.com/sdk/getting-started/settings/#media-hash-algorithm). xxHash is non-cryptographic but sufficient for content addressing.

## Recompute layout after programmatic changes

Methods like [`setPlaybackSpeed`](https://docs.rendley.com/sdk/getting-started/playback-speed/), [`setStartTime`](https://docs.rendley.com/sdk/api-reference/classes/Clip.html#setstarttime), [`setLeftTrim`](https://docs.rendley.com/sdk/api-reference/classes/Clip.html#setlefttrim), and [`setRightTrim`](https://docs.rendley.com/sdk/api-reference/classes/Clip.html#setrighttrim) can change a clip’s position or duration in the timeline. Call [`Timeline.adjustClipsLayout()`](https://docs.rendley.com/sdk/getting-started/timeline/#adjust-layout) afterwards so overlapping clips are reflowed.

## Scope undo/redo groups

When performing a compound change (for example, transform + style + text), wrap the operations in a single undo group so the user can undo them atomically. See [Undo / Redo](https://docs.rendley.com/sdk/getting-started/undo-redo/#grouping-changes).

## Preload fonts before adding text

Font loading is asynchronous and can cause a flash of unstyled text on the canvas. Call [`FontRegistry.loadFromCssUrl()`](https://docs.rendley.com/sdk/getting-started/fonts/) before creating text clips:

```
await Engine.getInstance()
  .getFontRegistry()
  .loadFromCssUrl("Inter", "https://fonts.googleapis.com/css2?family=Inter&display=swap");
// Now text clips using "Inter" render immediately.
```

## Dispose the engine on unmount

In single-page applications, destroy the engine when the editor component unmounts to free GPU and memory resources:

```
Engine.getInstance().dispose();
```

Skipping this in a React or Vue app leads to WebGL context leaks if the user navigates away and back.

## Pin media to layers deliberately

Clips on the same layer cannot overlap in time. If you add media programmatically, assign it to explicit layers rather than relying on auto-placement. See [Layers](https://docs.rendley.com/sdk/getting-started/layer/) for the API.

## What to read next

- **[Render in the browser](https://docs.rendley.com/sdk/rendering/render-on-device/)** encodes on the user machine with WebCodecs.
- **[Render on a server](https://docs.rendley.com/sdk/rendering/render-on-server/)** runs the same pipeline headlessly for production volume.
- **[Timeline](https://docs.rendley.com/sdk/getting-started/timeline/)** arranges layers and clips in time.
- **[Export to MP4](https://docs.rendley.com/sdk/getting-started/export/)** encodes the composition and tracks progress.

[Previous pageBackground removal](https://docs.rendley.com/sdk/examples/background-removal/) [Next pageTroubleshooting](https://docs.rendley.com/sdk/troubleshooting/)
