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

[EuiComboBox] Performance issue on rerender #4866

Closed
dej611 opened this issue Jun 8, 2021 · 1 comment · Fixed by #7215
Closed

[EuiComboBox] Performance issue on rerender #4866

dej611 opened this issue Jun 8, 2021 · 1 comment · Fixed by #7215
Assignees
Labels

Comments

@dej611
Copy link
Contributor

dej611 commented Jun 8, 2021

The AutosizeInput internal component within the EuiComboBox is causing noticeable performance issue in a UI on component rerender.

The code around the EuiComboBox had to be optimized to strongly minimize rerenders of the component due to an internal UI reflow triggered by the internal AutosizeInput component.

To give an idea of the performance impact, this is a profile read of a single state update operation in Lens:

Screenshot 2021-06-07 at 17 03 52

Same chart with the timings popup:

Screenshot 2021-06-07 at 17 04 30

This is the line that triggers the performance issue: https://github.com/JedWatson/react-input-autosize/blob/8a68b453ca1dec723e255c40eab7f2928228fe22/src/AutosizeInput.js#L103
That single read operation of the scrollWidth property triggers a full reflow which takes more than 100ms in our case.
The situation is even worse with slower CPUs that seems to be hit even worse by this specific problem, here's a profile recording with regular CPU and "slower CPU" (simulated 4x slowdown CPU):

"Fast CPU":
Screenshot 2021-06-07 at 17 55 36

"4x slowdown CPU":
Screenshot 2021-06-07 at 17 52 38

Some ideas

Not sure there's a specific solution for this problem, but it may help to add some documentation on the EuiComboBox page in a way to make the user aware of the problem - suggesting how to minimize re-renders.

@dej611 dej611 added the bug label Jun 8, 2021
@cee-chen
Copy link
Contributor

cee-chen commented Feb 6, 2023

It's possible that this may be fixed when we refactor EuiComboBox to use EuiSelectable under the hood (which we'll be doing not just for perf reasons but also accessibility consistency): #2841

We should certainly look into that refactor sometime soon as a result.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants