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

missing global.nativePerformanceNow #27274

Closed
parth3724 opened this issue Nov 20, 2019 · 3 comments
Closed

missing global.nativePerformanceNow #27274

parth3724 opened this issue Nov 20, 2019 · 3 comments
Labels
Bug Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@parth3724
Copy link

parth3724 commented Nov 20, 2019

In React native android app, using react native version 0.59.8, global.nativePerformanceNow is not defined.

React Native version: 0.59.8

Steps To Reproduce

  1. Try to get time value in any js file using global.nativePerformanceNow()

Describe what you expected to happen:
As it was described in RN version 55.3 AndroidJSCFactory.cpp,
// Since SystemClock.uptimeMillis() is commonly used for performance measurement in Java
// and uptimeMillis() internally uses clock_gettime(CLOCK_MONOTONIC),
// we use the same API here.
// We need that to make sure we use the same time system on both JS and Java sides.

We cannot use systrace in Android (since only stub is open sourced). We invested so much in building tooling to measure performance, and now when we change the version, such basic api vanishes.

https://github.com/facebook/react-native/blob/0.53-stable/ReactAndroid/src/main/jni/react/jni/AndroidJSCFactory.cpp

@parth3724 parth3724 added the Bug label Nov 20, 2019
@emilisb
Copy link
Contributor

emilisb commented Nov 22, 2019

I have encountered very same issue. After Profiler API (https://reactjs.org/docs/profiler.html) was released, this feature is even more important than before. Currently it is impossible to get precise execution time without the real performance.now() (and without using a remote debugger). Without performanceNow we are forced to use local date, which is not good enough.

It seems like this feature was removed during transition from JSC to JSI and it was never reimplemented.

I found commits that removed this feature:

Android: 7ffb406#diff-c2a333229249aaff833b2a50be32a489

iOS: 816d417

I don't see any reason to not reimplement it again.

In addition to that, could we implement a performance polyfill with at least most popular functions? Performance docs: https://developer.mozilla.org/en-US/docs/Web/API/Performance

@stale
Copy link

stale bot commented Feb 20, 2020

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Feb 20, 2020
@stale
Copy link

stale bot commented Feb 27, 2020

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

@stale stale bot closed this as completed Feb 27, 2020
@facebook facebook locked as resolved and limited conversation to collaborators Feb 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests

2 participants