fluentui icon indicating copy to clipboard operation
fluentui copied to clipboard

Performance: Tooltip is expensive render on hover regardless of the delay.

Open LiangMingChen opened this issue 7 years ago • 8 comments

Chrome

  • Package version(s): (fill this out)
  • Browser and OS versions: (fill this out if relevant)

Please provide a reproduction of the bug in a codepen:

Actual behavior:

https://developer.microsoft.com/en-us/fabric#/controls/web/tooltip

<CallOut> is relative expensive due to the nature of the implementation which need to determine where to pop the call out on position (which imply force render during the requestAnimation.

<ToolsTipContainer> which render <ToolsTip> <Tooltip> which leverage, the <Callout> except have a misleading delay property, As it turn out, that delay is only a style. When user hover it is, it already force all that caculation and update the id (DOM changes etc.)

I'd thought that "delay" should debounce the force-render & force caculation if user mouse out at the 500 ms.

https://github.com/OfficeDev/office-ui-fabric-react/blob/846c063f27dbc440ea9773ff735420d0ba7c1754/packages/office-ui-fabric-react/src/components/Tooltip/TooltipHost.base.tsx#L71

As it turn out, NO, it always render the call out, only CSS "animation" to delay the show .

Question: why do we force-render always even when user glide through a list of buttons with tool tips. & only with "animation" fade-in delay.

https://github.com/OfficeDev/office-ui-fabric-react/blob/846c063f27dbc440ea9773ff735420d0ba7c1754/packages/office-ui-fabric-react/src/components/Tooltip/Tooltip.styles.ts#L16

Suggestion: can we debounce base on the TooltipHost delay that actually save the render performance?

Expected behavior:

ToolsTipHost.delay will actually shave force-rendering need for <Callout&tg; rather than fake perceived CSS style of animation delay of fade in.

Here is <Callout> get the actual high. https://github.com/OfficeDev/office-ui-fabric-react/blob/846c063f27dbc440ea9773ff735420d0ba7c1754/packages/office-ui-fabric-react/src/components/Callout/CalloutContent.base.tsx#L374

Priorities and help requested:

Are you willing to submit a PR to fix? (Yes, No)

Requested priority: (Blocking, High, Normal, Low)

Products/sites affected: (if applicable)

LiangMingChen avatar Jun 03 '19 19:06 LiangMingChen

Hi @LiangMingChen, the delay was never intended to lazy load the control, just to delay the visibility. Webpack 4 might have ways to lazyload unnecessary content but we can't really change how the files are loaded ourselves - that requires build time processing we can't bake into our components. You might have to create 2 bundles for this app - one without the layer and one with.

aneeshack4 avatar Jun 03 '19 21:06 aneeshack4

No, I don't think this is delay load issue, it should not render the <Callout> thus cause the force render . If you don't understand on what's the render cost impact the performance, you should really look up the following -- it have nothing to do with delay load Chrome Dev Lead have page on this. https://gist.github.com/paulirish/5d52fb081b3570c81e3a

Rendering on the Web: Performance Implications of Application Architecture (Google I/O ’19) https://www.youtube.com/watch?v=k-A2VfuUROg

image

image

LiangMingChen avatar Jun 04 '19 19:06 LiangMingChen

@LiangMingChen Are you referring to using <DelayedRender> to wrap the <Callout> inside Tooltip so that if there's a delay and you hover over a tooltip but leave before the delay's done, the tooltip doesn't render?

aneeshack4 avatar Jun 04 '19 21:06 aneeshack4

@LiangMingChen please checkout this PR #9341 and let us know if this is what you had in mind too.

aneeshack4 avatar Jun 04 '19 21:06 aneeshack4

@LiangMingChen please checkout this PR #9341 and let us know if this is what you had in mind too.

Yes, that's what I have in mind. I have put the comment on the CSS class, since we have this, we should consider remove the https://github.com/OfficeDev/office-ui-fabric-react/blob/8a471edeec02db18f201db9790da374c573f9f2b/packages/office-ui-fabric-react/src/components/Tooltip/Tooltip.styles.ts#L16

All the delayAnimation style should remove?

In addition delay for tooltip is a Enum (0, 1, 2), that should be update with ms?

LiangMingChen avatar Jun 05 '19 01:06 LiangMingChen

:tada:This issue was addressed in #9341, which has now been successfully released as [email protected].:tada:

Handy links:

msft-github-bot avatar Jun 17 '19 12:06 msft-github-bot

#9341 is reverted with #9495 so opening this back up.

aneeshack4 avatar Jun 18 '19 17:06 aneeshack4

Closing it due to the issue being fixed in #9845

Vitalius1 avatar Jul 18 '19 19:07 Vitalius1