d25d482dc2
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled
Publish CLI Package / publish-npm (push) Has been cancelled
Publish Python SDK / publish-pypi (push) Has been cancelled
Publish TypeScript SDK / publish-npm (push) Has been cancelled
89 lines
2.8 KiB
Markdown
89 lines
2.8 KiB
Markdown
# Performance
|
|
|
|
Transition specificity and GPU compositing hints.
|
|
|
|
## Transition Only What Changes
|
|
|
|
Never use `transition: all` or Tailwind's `transition` shorthand (which maps to `transition-property: all`). Always specify the exact properties that change.
|
|
|
|
### Why
|
|
|
|
- `transition: all` forces the browser to watch every property for changes
|
|
- Causes unexpected transitions on properties you didn't intend to animate (colors, padding, shadows)
|
|
- Prevents browser optimizations
|
|
|
|
### CSS Example
|
|
|
|
```css
|
|
/* Good — only transition what changes */
|
|
.button {
|
|
transition-property: scale, background-color;
|
|
transition-duration: 150ms;
|
|
transition-timing-function: ease-out;
|
|
}
|
|
|
|
/* Bad — transition everything */
|
|
.button {
|
|
transition: all 150ms ease-out;
|
|
}
|
|
```
|
|
|
|
### Tailwind
|
|
|
|
```tsx
|
|
// Good — explicit properties
|
|
<button className="transition-[scale,background-color] duration-150 ease-out">
|
|
|
|
// Bad — transition all
|
|
<button className="transition duration-150 ease-out">
|
|
```
|
|
|
|
### Tailwind `transition-transform` Note
|
|
|
|
`transition-transform` in Tailwind maps to `transition-property: transform, translate, scale, rotate` — it covers all transform-related properties, not just `transform`. Use this when you're only animating transforms. For multiple non-transform properties, use the bracket syntax: `transition-[scale,opacity,filter]`.
|
|
|
|
## Use `will-change` Sparingly
|
|
|
|
`will-change` hints the browser to pre-promote an element to its own GPU compositing layer. Without it, the browser promotes the element only when the animation starts — that one-time layer promotion can cause a micro-stutter on the first frame.
|
|
|
|
This particularly helps when an element is changing `scale`, `rotation`, or moving around with `transform`. For other properties, it doesn't help much — the browser can't composite them on the GPU anyway.
|
|
|
|
### Rules
|
|
|
|
```css
|
|
/* Good — specific property that benefits from GPU compositing */
|
|
.animated-card {
|
|
will-change: transform;
|
|
}
|
|
|
|
/* Good — multiple compositor-friendly properties */
|
|
.animated-card {
|
|
will-change: transform, opacity;
|
|
}
|
|
|
|
/* Bad — never use will-change: all */
|
|
.animated-card {
|
|
will-change: all;
|
|
}
|
|
|
|
/* Bad — properties that can't be GPU-composited anyway */
|
|
.animated-card {
|
|
will-change: background-color, padding;
|
|
}
|
|
```
|
|
|
|
### Useful Properties
|
|
|
|
| Property | GPU-compositable | Worth using `will-change` |
|
|
| --- | --- | --- |
|
|
| `transform` | Yes | Yes |
|
|
| `opacity` | Yes | Yes |
|
|
| `filter` (blur, brightness) | Yes | Yes |
|
|
| `clip-path` | Yes | Yes |
|
|
| `top`, `left`, `width`, `height` | No | No |
|
|
| `background`, `border`, `color` | No | No |
|
|
|
|
### When to Skip
|
|
|
|
Modern browsers are already good at optimizing on their own. Only add `will-change` when you notice first-frame stutter — Safari in particular benefits from it. Don't add it preemptively to every animated element; each extra compositing layer costs memory.
|