Add profiler plugin for each platform#15
Open
tmarmer wants to merge 10 commits into
Open
Conversation
tmarmer
commented
May 8, 2026
Comment on lines
+1
to
+3
| export const getNowTime = globalThis.performance | ||
| ? () => globalThis.performance.now() | ||
| : () => Date.now(); |
Author
There was a problem hiding this comment.
performance isn't available on the ios and kotlin integrations, so it's preferred for accuracy but Date.now still works.
| "id": "Profile-main", | ||
| "type": "flame-graph", | ||
| "binding": "rootNode", | ||
| "width": "@[{{rootNode.value}} / 200]@", |
Author
There was a problem hiding this comment.
This looks weird but it helps normalize the width of each bar on the graph to be 5px per millisecond. Since flame-graph doesn't show times this helps with at least seeing how long everything takes.
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.
This PR adds the ProfilerDevtoolsPlugin, available at the core layer with wrappers on each platform.
ProfileNodewhich will have the start and end times, using theperformanceAPI when avialable, but defaulting toDate.nowotherwise.valueof each node is the total duration and is used by theflame-graphasset to determine the width of the bars it displaysnameis displayed on the graph andtooltipis displayed on hoverchildrenstructure is inferred by when hooks are called, and is only needed for theflame-graphasset to render correctly.flame-graphwith something that can better show the timings.flame-graphasset by inserting spacers and removing anything with avalueof 0(work)spacers provide a way to show the reelative timing with which a hook started relative to the its parentvalueof 0 doesn't render anyway so removing those helps group a few spacers to clean up the ui.rawDatatab to show the profiling information without the transformation step.Flame Graph:

Raw Data:

Change Type (required)
Indicate the type of change your pull request is:
patchminormajor