feat(example): add animation benchmark demo#10
Merged
janicduplessis merged 8 commits intomainfrom Mar 20, 2026
Merged
Conversation
Add a benchmark screen that measures per-frame UI thread overhead across 4 animation approaches: ease, reanimated shared value, reanimated CSS, and RN Animated. Uses an Expo local module (frame-metrics) wrapping: - Android: FrameMetrics API (ANIMATION_DURATION, LAYOUT_MEASURE_DURATION, DRAW_DURATION) for precise per-component breakdown - iOS: CADisplayLink for frame delivery timing Configurable view count (10-500) with results showing avg/p95/p99 of UI thread time per frame, plus Android-specific breakdown table.
f044c34 to
57c6bca
Compare
- Add podspec for iOS autolinking - Swizzle CADisplayLink factory to measure callback duration per frame - Aggregate per-frame callback time using display link timestamp - Make UI thread time fields non-optional (both platforms report them) - Update iOS label to "Display link callback time per frame"
…lags Add benchmark charts comparing per-frame overhead of Ease vs Reanimated (SV/CSS) vs RN Animated on both Android and iOS. Enable Reanimated experimental feature flags in the example app for fair comparison (SYNCHRONOUSLY_UPDATE_UI_PROPS, USE_SYNCHRONIZABLE_FOR_MUTABLES, DISABLE_COMMIT_PAUSING_MECHANISM).
Remove unused return values (avgFrameTime, p95/p99FrameTime, droppedFrames, totalFrames, frameDurations, p95/p99AnimationTime) from both native modules and TypeScript types. Also remove the separate CADisplayLink for frame delivery timing on iOS since we only use the swizzle-based callback measurement.
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.
Description
There's no way to quantitatively compare the per-frame overhead of react-native-ease against other animation approaches. The existing Comparison demo is visual-only (lag switch), which shows resilience but not cost.
Solution
Adds a Benchmark screen to the example app that measures actual per-frame animation overhead across 4 approaches:
withTimingAnimated.timingwithuseNativeDriver: trueAll approaches run the same animation (continuous translateX loop, linear, 2s) on a configurable number of views (10–500).
Frame timing is collected via a new frame-metrics Expo local module:
Window.OnFrameMetricsAvailableListener— reports per-frameANIMATION_DURATION,LAYOUT_MEASURE_DURATION,DRAW_DURATION. Primary metric is UI thread time (anim + layout + draw sum) with correct per-frame percentiles.CADisplayLinkfactory to wrap every callback with timing. Aggregates total callback duration per frame using display link timestamp. This captures the actual work done in animation framework callbacks each frame.Preliminary Results
Android (release build, emulator, M4 MacBook Pro)
Detailed numbers
UI thread time per frame: anim + layout + draw (ms)
UI Thread Breakdown (avg ms, 500 views)
iOS (release build, simulator, iPhone 16 Pro, M4 MacBook Pro)
Detailed numbers
Display link callback time per frame (ms)
Test plan