Skip to content

[DataGrid] Add will-change to CSS to improve performance in chrome full screen mode - #3726

Merged
kertal merged 4 commits into
elastic:masterfrom
kertal:kertal-pr-2020-07-13-datagrid-add-will-change
Aug 3, 2020
Merged

kertal merged 4 commits into
elastic:masterfrom
kertal:kertal-pr-2020-07-13-datagrid-add-will-change

Conversation

@kertal

@kertal kertal commented Jul 13, 2020 •

Copy link
Copy Markdown
Member

Summary

Significant improvement of performance issues encountered in #3705. Screens taken using Chrome 83, MacBook Pro 15'' 2019 on a retina screen, rendering 100 rows.

Before:
image

After:

image

Important: pls test on a retina/high resolution monitor, there the lag is significant, and also the improvement

Checklist

- [ ] Check against all themes for compatibility in both light and dark modes
- [ ] Checked in mobile

  • Checked in IE11 and Firefox - Note: IE11 doesn't know this CSS prop
    - [ ] Props have proper autodocs
    - [ ] Added documentation
    - [ ] Checked Code Sandbox works for the any docs examples
    - [ ] Added or updated jest tests
    - [ ] Checked for breaking changes and labeled appropriately
    - [ ] Checked for accessibility including keyboard-only and screenreader modes
  • A changelog entry exists and is marked appropriately

@kibanamachine

Copy link
Copy Markdown
Contributor

@kertal kertal self-assigned this Jul 14, 2020
@kertal
kertal marked this pull request as ready for review July 14, 2020 08:39
@kibanamachine

Copy link
Copy Markdown
Contributor

@sulemanof

Copy link
Copy Markdown
Contributor

I still think that the most desirable thing to optimize the data grid performance is virtualized scrolling. I bet if we apply it to the data grid, we'll get rid of such a hover problem, therefore the will-change will be unnecessary.
As MDN says, the will-change property should be used as the last resort, if there is no other optimization to apply.
So I would say the first-point task to apply is the usage of virtual scroll. If it doesn't help, the will-change will be used finally. IMHO

@kertal

kertal commented Jul 14, 2020

Copy link
Copy Markdown
Member Author

I still think that the most desirable thing to optimize the data grid performance is virtualized scrolling. I bet if we apply it to the data grid, we'll get rid of such a hover problem, therefore the will-change will be unnecessary.
As MDN says, the will-change property should be used as the last resort, if there is no other optimization to apply.
So I would say the first-point task to apply is the usage of virtual scroll. If it doesn't help, the will-change will be used finally. IMHO

I do agree, that virtualize scrolling should be the best solution, but the performance lag in Chrome on a retina screen justifies a in between solution IMO. I've adapted the CSS to apply will-change only on the transforms of the row.

@cchaos cchaos left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, reading through the spec, it seems that adding this directly to the stylesheet is not optimal. That, instead, the addition of this property should be handled via JS in anticipation of the change, not a blanket change. (See first example in the spec link).

@kertal

kertal commented Jul 21, 2020

Copy link
Copy Markdown
Member Author

Hmm, reading through the spec, it seems that adding this directly to the stylesheet is not optimal. That, instead, the addition of this property should be handled via JS in anticipation of the change, not a blanket change. (See first example in the spec link).

ok, agreed, will implement the JS approach

@kertal

kertal commented Aug 3, 2020

Copy link
Copy Markdown
Member Author

Hmm, reading through the spec, it seems that adding this directly to the stylesheet is not optimal. That, instead, the addition of this property should be handled via JS in anticipation of the change, not a blanket change. (See first example in the spec link).

I've tried to add the property directly but in this case it doesn't help, that was the draft
eui____projects_eui__-_____src_components_datagrid_data_grid_data_row_tsx
I think will-change needs to be added before the operation starts, but in this case, changing the background color on hover was already started by onMouseEnter. don't think there's a good solution to solve this, so it might be wiser to use the CSS way or to close this PR, it should be fixed by virtualization.

@cchaos

cchaos commented Aug 3, 2020

Copy link
Copy Markdown
Contributor

Thanks for looking into that solution. Honestly, I'd rather just wait for virtualization rather than throw in a rule that could be more detrimental to the overall browser performance when DataGrid's don't exist.

@cchaos cchaos left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I will walk back my previous statement after reviewing your before and after screenshots again. There is quite an improvement being made. Let's go ahead and get this merged but, @chandlerprall can you be sure to test your virtualization effort without this?

The PR will need to be rebased with master to get the lastest changes to the changelog.

@kertal
kertal force-pushed the kertal-pr-2020-07-13-datagrid-add-will-change branch from 800d0c0 to 4ef681b Compare August 3, 2020 14:26
@kertal

kertal commented Aug 3, 2020

Copy link
Copy Markdown
Member Author

thx @cchaos, so I can also finish #3668 which made the performance worse in this case. had to force push, because rebase messed up the GitHub commit history, and no I wanted to adapt the Changelog, but the linter complains because of 293 errors, that seem to be unrelated to my 1 line of Changelog add-on 😄. how should I fix this?

@kibanamachine

Copy link
Copy Markdown
Contributor

@kertal

kertal commented Aug 3, 2020

Copy link
Copy Markdown
Member Author

ok, seemed to be a eslint cache issue that has been resolved locally be upgrading node. I could commit the changelog entry

@kibanamachine

Copy link
Copy Markdown
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants