-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[Performance] [Audit] withOnyx(ReportActionCompose)
is very slow to render
#4116
Comments
Triggered auto assignment to @michaelhaxhiu ( |
I'm not sure, but if I had to guess I'd maybe think the late "loaded" is in part possibly to the fact that we are fetching this data cold from storage instead of using any cache. I think @kidroca's cache improvements might be addressing some part of this. We have caching but we somewhat aggressively clear this cache at the moment. Adding LRU caching will probably help here since we subsequent reads will be faster - although initial reads would still be as slow as they are now.
The
Hard to say whether that is a problem or not, but that might help guide someone to look into this further. |
Also maybe it's just as simple as... Are we really using all the information being passed to it? |
I suggest we break it down into sub-components. |
The thing is, we're only interested in one peculiar report action in this component. There is a high chance that the report action didn't change after being fetched, but the reference in memory will have changed, causing a re-render. Is there a history version ID for each report action (or last modified field) that you could use in order to avoid extraneous commits, by using |
Hey guys I think I know why this view is slow to render and it is this composition right here This composition is evaluated at render time, before adding the spinner you could even see the compose box coming together in chunks A quick test can be to remove the |
Perhaps... if we are trying to eliminate the It seems there is no reason this component needs to be constantly aware of To be honest, there are lots of small issues like this everywhere that make app logic unnecessarily complicated and add more subscribers than necessary. This could quite easily be solved by having a store getter. e.g. if instead of a subscription this was replaced with a synchronous call to retrieve the cached value of
That's also interesting @kidroca I wonder if the two issues are somehow compounded. Bad rendering performance of the |
I maybe want to suggest holding on solving this one in particular, but curious if others agree. In my own testing, this component doesn't seem to have a great impact on chat switching times. I removed it completely from the code and the slowness related to switching from one chat to another was still present. Which tells me that the highest value improvements will be to improving rendering speed of individual report actions. |
@marcaaron I just want to emit one hypothesis though: if other elements in the render tree of each cell suffer from the same lag (e.g. some subscribed values are emitted very lately), then your testing would have missed its target. Perhaps it would be interesting, although a substantial endeavor, to render a list from hard-coded data (with the same HTML content to render) in order to efficiently assess the alleged lag caused by Onyx. |
Ah, let me see, so in this case, |
Am I correct in understanding that Peter's PR adds a repeatable benchmark
timing code? Can you test it using that?
…On Mon, Jul 19, 2021, 4:15 PM Marc Glasser ***@***.***> wrote:
if other elements in the render tree of each cell suffer from the same lag
(e.g. some subscribed values are emitted very lately), then your testing
would have missed its target
Ah, let me see, so in this case, ReportActionCompose there is only one
per chat. My naive assumption is that by removing it entirely (all other
things being equal) the chat screen should render faster. But it does not
have a noticeable impact (this is w/out any benchmarks and me just using my
eyes).
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#4116 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAEMNURWZ6B2FDKV3HHJSGDTYSWYZANCNFSM5AP6IQDQ>
.
|
So far we've seen it used to more broadly show the total time Onyx spent working. @kidroca Is there a way we can use your tool to granular and maybe see how much time a single component and all its children spent communicating with Onyx? If not, one idea for how to do it would be
That should tell us how long the wrapped component was "waiting for data" On the other hand, to get a rough idea for how much time a component spent laying out it's UI we can
It would be good to differentiate between how long something is "waiting for data" from how long something "takes to show up on screen" after it has all the data it needs. |
This comment has been minimized.
This comment has been minimized.
Whoa. So what does that mean, and how do we fix it?
…On Mon, Jul 19, 2021, 10:35 PM Marc Glasser ***@***.***> wrote:
Quick update on that idea above... I tried hooking up a basic start/end
trace to withOnyx to get some timing information for how much "waiting"
we are actually doing. It seems like there is a cascading effect where
components are waiting for the data from Onyx, but also waiting for each
other to get that data first. I'm not 100% sure this is happening but this
data seems to suggest it is since there are cases where each message is
taking an incrementally larger amount of time to render nearly identical
data.
[Onyx] withOnyx(ReportView) loaded in: 100.10 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItem) loaded in: 105.10 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItem) loaded in: 114.80 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItem) loaded in: 121.40 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItem) loaded in: 129.70 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItem) loaded in: 134.60 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItem) loaded in: 142.30 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItem) loaded in: 147.80 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItem) loaded in: 155.90 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ReportActionContextMenu)) loaded in: 185.60 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ReportActionContextMenu)) loaded in: 187.60 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ConfirmModal)) loaded in: 195.80 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ReportActionContextMenu)) loaded in: 198.10 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ReportActionContextMenu)) loaded in: 200.40 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ConfirmModal)) loaded in: 208.70 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ReportActionContextMenu)) loaded in: 209.30 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ReportActionContextMenu)) loaded in: 210.70 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ConfirmModal)) loaded in: 217.40 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ReportActionContextMenu)) loaded in: 215.60 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ReportActionContextMenu)) loaded in: 218.70 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ConfirmModal)) loaded in: 226.00 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ReportActionContextMenu)) loaded in: 224.30 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ReportActionContextMenu)) loaded in: 227.70 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ConfirmModal)) loaded in: 235.50 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ReportActionContextMenu)) loaded in: 237.60 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ReportActionContextMenu)) loaded in: 241.00 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ConfirmModal)) loaded in: 246.70 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ReportActionContextMenu)) loaded in: 246.70 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ReportActionContextMenu)) loaded in: 249.30 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ConfirmModal)) loaded in: 256.40 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ReportActionContextMenu)) loaded in: 254.20 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ReportActionContextMenu)) loaded in: 256.40 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ConfirmModal)) loaded in: 264.10 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ReportActionContextMenu)) loaded in: 264.10 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ReportActionContextMenu)) loaded in: 266.20 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ConfirmModal)) loaded in: 273.00 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ReportActionContextMenu)) loaded in: 273.90 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ReportActionContextMenu)) loaded in: 276.50 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ConfirmModal)) loaded in: 282.00 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ReportActionContextMenu)) loaded in: 280.00 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ReportActionContextMenu)) loaded in: 282.40 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ConfirmModal)) loaded in: 289.10 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ReportActionContextMenu)) loaded in: 287.70 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ReportActionContextMenu)) loaded in: 289.50 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ConfirmModal)) loaded in: 295.80 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ReportActionContextMenu)) loaded in: 294.50 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ReportActionContextMenu)) loaded in: 296.60 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ConfirmModal)) loaded in: 302.10 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ReportActionContextMenu)) loaded in: 301.10 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ReportActionContextMenu)) loaded in: 303.70 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ConfirmModal)) loaded in: 311.70 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ReportActionContextMenu)) loaded in: 308.20 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ReportActionContextMenu)) loaded in: 310.30 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ConfirmModal)) loaded in: 317.20 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ReportActionContextMenu)) loaded in: 312.70 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ReportActionContextMenu)) loaded in: 314.40 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ConfirmModal)) loaded in: 321.80 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ReportActionContextMenu)) loaded in: 316.50 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ReportActionContextMenu)) loaded in: 318.40 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ConfirmModal)) loaded in: 324.60 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ReportActionContextMenu)) loaded in: 322.30 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ReportActionContextMenu)) loaded in: 324.00 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ConfirmModal)) loaded in: 329.10 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ReportActionContextMenu)) loaded in: 321.00 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ReportActionContextMenu)) loaded in: 322.70 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ConfirmModal)) loaded in: 329.80 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ReportActionContextMenu)) loaded in: 323.60 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ReportActionContextMenu)) loaded in: 326.70 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ConfirmModal)) loaded in: 333.50 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ReportActionContextMenu)) loaded in: 329.60 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ReportActionContextMenu)) loaded in: 331.30 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ConfirmModal)) loaded in: 337.00 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ReportActionContextMenu)) loaded in: 334.30 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ReportActionContextMenu)) loaded in: 336.80 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ConfirmModal)) loaded in: 341.90 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ReportActionContextMenu)) loaded in: 337.40 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ReportActionContextMenu)) loaded in: 341.30 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ConfirmModal)) loaded in: 347.90 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ReportActionContextMenu)) loaded in: 344.20 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ReportActionContextMenu)) loaded in: 346.30 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ConfirmModal)) loaded in: 352.40 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ReportActionContextMenu)) loaded in: 347.40 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ReportActionContextMenu)) loaded in: 349.30 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ConfirmModal)) loaded in: 354.30 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 513.50 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 512.60 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 511.10 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 507.60 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 504.00 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 503.00 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 502.30 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 499.80 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 498.60 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 497.00 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 494.40 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 492.00 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 490.90 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 489.40 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 484.70 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 480.40 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 474.50 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 470.20 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 462.40 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 455.70 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 450.30 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 446.50 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 442.70 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 440.00 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 434.00 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionCompose) loaded in: 689.30 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 148.20 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 146.60 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 143.00 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 140.70 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 140.00 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 137.00 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 134.30 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 133.10 ms
2withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 132.10 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ConfirmModal)) loaded in: 101.40 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ReportActionContextMenu)) loaded in: 102.10 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ReportActionContextMenu)) loaded in: 104.30 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ConfirmModal)) loaded in: 110.10 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ReportActionContextMenu)) loaded in: 110.00 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ReportActionContextMenu)) loaded in: 112.10 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ConfirmModal)) loaded in: 119.60 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 176.90 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 174.30 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 172.00 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 169.90 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 167.50 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 165.00 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 160.80 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 158.80 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 156.70 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 154.90 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ConfirmModal)) loaded in: 104.50 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 156.20 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 154.90 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 152.00 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 150.00 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 148.60 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 146.00 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 145.60 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 141.90 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 139.60 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 139.30 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ConfirmModal)) loaded in: 106.10 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 160.00 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 157.70 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 155.20 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 154.90 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 151.40 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 150.20 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 146.30 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 144.50 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 142.30 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 141.20 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ConfirmModal)) loaded in: 100.70 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ReportActionContextMenu)) loaded in: 100.50 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ReportActionContextMenu)) loaded in: 103.00 ms
withOnyx.js:123 [Onyx] withOnyx(WithLocalize(ConfirmModal)) loaded in: 108.90 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 159.20 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 158.70 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 157.40 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 153.40 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 152.50 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 151.20 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 148.40 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 147.30 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 145.40 ms
withOnyx.js:123 [Onyx] withOnyx(ReportActionItemMessage) loaded in: 143.90 ms
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#4116 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAEMNUTBB33VOAFRUQAWEDLTYUDJ3ANCNFSM5AP6IQDQ>
.
|
It only works for promise based functions, and help us track how much time we spent reading/writing individual keys. It's not suitable to measure render, but the print/export functionality developed there can help Instead of patching Component code with start/end I found this: So we can do something like this: Onyx.js withOnyx.displayName = `withOnyx(${getDisplayName(WrappedComponent)})`;
return React.forwardRef((props, ref) => {
const Component = withOnyx;
return (
// This is turned off in production and just returns the child Component
<Profiler id={props.profileId || Component.displayName} onRender={reactProfilerCallback}>
<Component {...props} forwardedRef={ref} />
</Profiler>
);
}); As a POC I've implemented Onyx Benchmark
withOnyx(ReportActionCompose)This component is on the faster end of
The docs state that Another cool feature about this is I can set a breakpoint for components that took more than 100 200, 300ms to render and investigate live |
I'm not sure what are you observing
This is how React works by design, it would batch some updates together for performance. You can see it in my data as well, where several renders of the same component type would have a different start time, but the same commit time (commit is when didMount is called)
withOnyx(ReportActionItem)
Another reason for such delay is the optimization we have for retrieving value from storage
If the components above all need something that's not in cache - the first component that needs it Also it's very likely you're printing live on the console |
@quinthar In the simplest terms, I think connecting any component via
@kidroca Just to clarify, if we are using the profiler to measure the
Can you explain where this batching is happening and how the data collected (either mine or yours) supports it? Not sure I am following, but would be interested in hearing the expert explanation. I would like to propose that we add some kind of logging to
Thoughts on whether this would be valuable / the best way to implement it? |
@kidroca we might be cherry picking information that supports some theories we each want to believe 😅 Yes, there are examples where it becomes incrementally faster for each subsequent component. But also look at this burst of
Anyways I'm not sure what it all means haha I thought it was interesting or someone might have a better explanation. |
@marcaaron
What's the exact implementation for this?
No this only measures the time it took to render or update the component
In my data here #4116 (comment) you can see different start times but the same commit time React keeps a Virtual DOM. As components render React creates a diff of changes that need to be made to the actual DOM, it would not send updates on the moment, but wait for renders to finish and only then commit and apply a single precise patch to the DOM
The I'm not very keen on determining how much time it took
I'm not certain this will help much - the item contains children that are connected to Onyx as well. Each translated content is already subscribed to Onyx, and there are like 6 such components per each item It just configures a translator object and passes it down as props, this can be replaced by a The updates planned for Onyx should help keep items or their children connected to the store, but with an improved connection speed |
I pushed up a branch here if you want to assess the idea.
Please let me know if there's some easier way to derive it. Of course, I would appreciate a better solution :) I'm not seeing how to use the profiler to tell the time from:
Haha ok, well then I'd propose that we eliminate the children's subscribers too. And more broadly suggesting that given the current state of things it may not be wise to attach subscribers in situations where we need to render n items efficiently. That could be wrong, but there's an easy way to test. Remove the subscribers and see if there's any improvement.
Unsure how this relates to the current topic, but sounds like another thing to look into. 👍
I look forward to those changes and acknowledge your skepticism. But I wanted to suggest the idea that even the most performant iteration of Onyx imaginable may be less performant than not using it at all 😄 |
There has been some great back and forth on this issue. But some of it may be better discussed in #4101 I'm going to close this for now for focus, but we can re-open if we still have some specific problem with rendering the |
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
This report is part of #3957, scenario "Rendering Individual chat messages".
Commit log
The full commit log can be inspected with Flipper or React Devtools, see #3957 (comment) for instructions. This excerpt takes commits relevant to one
withOnyx(ReportActionCompose)
instance, child of cell with key 70797025.SHOW LOG
19- Renders
24
- Renders
25
- Renders
26
- Renders
27
- Renders
28
- Renders
29
- Renders
30
- Renders
31
- Renders
76
- Renders
192
- Renders
193
- Renders
215
- Renders
220
- Renders
withOnyx(ReportActionCompose)
, first renderwithOnyx(ReportActionCompose)
, becausebetas
state changedwithOnyx(ReportActionCompose)
, becausecomment
state changedwithOnyx(ReportActionCompose)
, becausemodal
state changedwithOnyx(ReportActionCompose)
, becausenetwork
state changedwithOnyx(ReportActionCompose)
, becausemyPersonalDetails
state changedwithOnyx(ReportActionCompose)
, becausepersonalDetails
state changedwithOnyx(ReportActionCompose)
, becausereportActions
state changedwithOnyx(ReportActionCompose)
, becausereport
state changedwithOnyx(ReportActionCompose)
, becausereport
state changedwithOnyx(ReportActionCompose)
, becauseblockedFromConcierge
state changedwithOnyx(ReportActionCompose)
, becauseloading
state changedwithOnyx(ReportActionCompose)
, becausereportActions
state changedwithOnyx(ReportActionCompose)
, becausereport
state changedFlamegraph
Problems
First of all, the commit log already highlights issue reported in #4101, but there is more. Inspect the log by pressing SHOW LOG in the section above.
Issue 1:
loaded
state is set to true very lately (c220, at 6.1s)It looks like
blockedFromConcierge
is fired lately (c192, at 5.4s) while the latest preceding value was fired in c76 (at 1.7s), so that's over 3 seconds later.Issue 2:
report
andreportActions
are emitted multiple timesreport
is emitted at c31, c76 and c220reportActions
is emitted at c30 and c215Proposal: investigate further those Onyx bottlenecks
blockedFromConcierge
is fired 3.7 seconds after the first burst ending at c31report
andreportActions
are emitted multiple times for the same cellThe text was updated successfully, but these errors were encountered: