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

Rewrite isAnimated function #3949

Merged
merged 1 commit into from Jan 17, 2023
Merged

Rewrite isAnimated function #3949

merged 1 commit into from Jan 17, 2023

Conversation

tomekzaw
Copy link
Member

@tomekzaw tomekzaw commented Jan 13, 2023

Summary

This PR provides a new better implementation of isAnimated utility function as the previous version was very poorly written. The old implementation holds a queue of props to be checked and thus needs to allocate and populate a new array on each call, whereas the new implementation uses recursion instead – however, in most of the real-world cases, it is never called recursively. Since isAnimated is used very frequently throughout the codebase, previously it took ~7% of total execution time. After the changes, it dropped down to ~3%.

Co-authored-by: @kmagiera

Test plan

Just check if BokehExample works.

@piaskowyk piaskowyk merged commit 93afccf into main Jan 17, 2023
@piaskowyk piaskowyk deleted the isanimated_rewrite branch January 17, 2023 15:29
tomekzaw added a commit that referenced this pull request Jan 17, 2023
## Summary

This PR provides a new better implementation of `isAnimated` utility
function as the previous version was very poorly written. The old
implementation holds a queue of props to be checked and thus needs to
allocate and populate a new array on each call, whereas the new
implementation uses recursion instead – however, in most of the
real-world cases, it is never called recursively. Since `isAnimated` is
used very frequently throughout the codebase, previously it took ~7% of
total execution time. After the changes, it dropped down to ~3%.

Co-authored-by: @kmagiera

## Test plan

Just check if BokehExample works.
fluiddot pushed a commit to wordpress-mobile/react-native-reanimated that referenced this pull request Jun 5, 2023
## Summary

This PR provides a new better implementation of `isAnimated` utility
function as the previous version was very poorly written. The old
implementation holds a queue of props to be checked and thus needs to
allocate and populate a new array on each call, whereas the new
implementation uses recursion instead – however, in most of the
real-world cases, it is never called recursively. Since `isAnimated` is
used very frequently throughout the codebase, previously it took ~7% of
total execution time. After the changes, it dropped down to ~3%.

Co-authored-by: @kmagiera

## Test plan

Just check if BokehExample works.
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.

None yet

3 participants