Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance metrics #3015

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Performance metrics #3015

wants to merge 8 commits into from

Conversation

mattgperry
Copy link
Collaborator

@mattgperry mattgperry commented Jan 21, 2025

This PR introduces a Motion performance tracking API.

import { recordStats } from "motion/debug"

const report = recordStats()

animate(0, 100)

setTimeout(() => {
  const stats = report()
}, 100)

Reported stats take the form:

interface Summary {
    min: number
    max: number
    avg: number
}

interface Stats<T> {
    frameloop: {
        [key in FrameLoopStatNames]: Summary
    }
    animations: {
        mainThread: Summary
        waapi: Summary
        layout: Summary
    }
    layoutProjection: {
        nodes: Summary
        calculatedTargetDeltas: Summary
        calculatedProjections: Summary
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant