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.
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
Implement nativePerformanceNow to improve Profiler API results #27885
Implement nativePerformanceNow to improve Profiler API results #27885
Changes from 1 commit
868b947
a320543
67ed052
70da200
8556fae
79defd9
c329299
9e32105
d64f79d
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Is there a reason to bind this here (in each executor factory) instead of in somewhere more central like Instance::bindBridge? (I guess that would probably involve changing the API for bindBridge to add another parameter, which would be a breaking change for any other executors that aren't part of RN core). I'm just wondering because it seems like the difference between how we bind nativePerformanceNow is based on the platform we're running on, not the JS VM, so we don't necessarily need this to be in the JS executor factory.
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.
It seemed like a good place to use without making any breaking changes. Logging binder is there too.
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.
Do we need to have the polyfill? I think we really want to remove polyfills instead of adding more... what if we just added a JS module that people could require normally if they want to use it?
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.
I looked through the code, and I noticed that if Systrace is enabled,
Libraries/Performance/Systrace.js
would overrideglobal.performance
. What if we load performance module inInitializeCore.js
, and combineperformance.now
with all the methods from Systrace into one module that would defineperformance
?Edit: nevermind, it would not work, we cannot access nativePerformanceNow binding in this stage.
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.
Why can't we access
nativePerformanceNow
? It should be installed already, right?Forgive the ignorant question, but - what would happen if, instead of installing
global.nativePerformanceNow
, we just actually installedglobal.performance.now
directly instead? Would that be a disaster?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.
I have no idea why I initially thought we cannot access
nativePerformanceNow
there. I moved the polyfill to Core instead.The rest of
performance
implementation is in JS (it's part ofSystrace
), so I think it would be better to keepnow
in JS as well. Also, it's nice to have a fallback in case the executor has noperformance.now
implementation.