Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add
performance.now()
to Worklets (#2679)
## Description Adds support for measuring performance/elapsed time in millisecond precision using Chrono with `performance.now()` in Worklets. ## Changes - Inject `_chronoNow` func in global runtime object <!-- ## Screenshots / GIFs Here you can add screenshots / GIFs documenting your change. You can add before / after section if you're changing some behavior. ### Before ### After --> ## Test code and steps to reproduce ```ts runOnUI(() => { 'worklet' const start = performance.now() for (let i = 0; i < 1000000; i++) {} const end = performance.now() console.log(`Loop took ${end - start} ms!`) })() ``` ## Checklist - [ ] Included code example that can be used to test this change - [ ] Updated TS types - [ ] Added TS types tests - [ ] Added unit / integration tests - [ ] Updated documentation - [ ] Ensured that CI passes ## Related Issues * facebook/react-native#32695
- Loading branch information
aef72c0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
has this fix been added to the npm package yet?
aef72c0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still throws an error.
React native version: 0.64.3
Expo: 44.0.2
react-native-reanimated: 2.3.1
aef72c0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes it still does and I don't know what's the solution I have downgraded and upgraded nothing yet