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

Rendering performance improvement for reports with many rows #18405

Merged
merged 10 commits into from Dec 6, 2021

Conversation

bx80
Copy link
Contributor

@bx80 bx80 commented Nov 30, 2021

Description:

refs #18394

Removes the obsolete handleColumnHighlighting() method which causes a significant performance hit when rendering a datatable with many rows.

Column width and row highlighting is now handled by CSS so this method should no longer be needed.

Review

@bx80 bx80 added not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. Needs Review PRs that need a code review labels Nov 30, 2021
@bx80 bx80 added this to the 4.7.0 milestone Nov 30, 2021
@bx80 bx80 self-assigned this Nov 30, 2021
Copy link
Member

@sgiehl sgiehl left a comment

Choose a reason for hiding this comment

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

This one can't be simply removed. The row highlight is covered by CSS. But when you hover a column, that column receives a class in each row. I don't think this can be covered by CSS. Now the ratio values aren't displayed (e.g. for visits or page views) anymore as it relies on that class. See

td.highlight > .ratio {
visibility: visible;
}

@sgiehl sgiehl removed the Needs Review PRs that need a code review label Nov 30, 2021
@bx80
Copy link
Contributor Author

bx80 commented Dec 1, 2021

The 'give all values consistent width' part of handleColumnHighlighting() is the real performance hit, adding mouse event handlers to add/remove classes doesn't really impact loading speed. So I've restored the method and tested again with just the width setting code disabled and performance is basically the same as with the handleColumnHighlighting() method disabled.
image
This means the ratio values will work and any other code that relies on the column highlight class being set.

@bx80
Copy link
Contributor Author

bx80 commented Dec 1, 2021

@sgiehl Following the theme of naively deleting random datatable functions... 😉

I think the performance heavy setFixWidthToMakeEllipsisWork() method can be replaced with a small CSS tweak. Setting the table cell width to calc(80%) should allow the ellipsis to be applied to the table label column using pure CSS without needing javascript to calculate and set a fixed cell width both initially and every time the table is resized.

I've committed this change for review and it seems to work well in the tests I've done. Can you think of any problems with this approach or anything I should specifically test?

@bx80 bx80 added the Needs Review PRs that need a code review label Dec 1, 2021
Copy link
Member

@sgiehl sgiehl left a comment

Choose a reason for hiding this comment

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

Oh dear. I would really love to get rid of that method. Struggling with it already for a while in #18386. The "problem" with all those methods is, that they are doing a lot more, than the name would let you think. The method setFixWidthToMakeEllipsisWork is actually also used to limit the width of a datatable to 1200px (if it's not widgetized), but it also ensures that a datatable doesn't always take all the space that would be available, but only what it really needs. In addition if fixes the size of the tables in "reportByDimension" view, which can be seen in the goal reports (the one with the additional dimension menu on the left). And I'm pretty sure it's responsible for some more stuff I don't see right now.

Removing that method actually broke most of the additional stuff...
Maybe for now remove that again, so we can already merge the other improvement. If needed you can then create new PRs with further improvements.

plugins/CoreHome/stylesheets/dataTable/_dataTable.less Outdated Show resolved Hide resolved
Copy link
Member

@sgiehl sgiehl left a comment

Choose a reason for hiding this comment

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

The code changes look fine. But there are actually a lot failures in the UI tests. Once the new build is finished you may need to look through all those changes, and check if they are actually expected, or if there are some regressions, where the table sizing maybe doesn't work correctly anymore.

@sgiehl sgiehl removed the Needs Review PRs that need a code review label Dec 3, 2021
@bx80 bx80 added the Needs Review PRs that need a code review label Dec 6, 2021
@bx80
Copy link
Contributor Author

bx80 commented Dec 6, 2021

I've updated all the screenshots for UI tests that failed from this change.

Copy link
Member

@sgiehl sgiehl left a comment

Choose a reason for hiding this comment

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

Looks got to merge now.
Btw. you forgot to create PR in submodule plugin to update the screenshots. I've done that for you. Also changing any submodule to another branch than 4.x-dev always needs to be reverted before a PR is merged. I'll do that once I saw if all related screenshot tests are passing.

@sgiehl sgiehl merged commit b7bfb36 into 4.x-dev Dec 6, 2021
@sgiehl sgiehl deleted the m-18394-reports-performance-many-rows branch December 6, 2021 13:36
@sgiehl sgiehl removed the Needs Review PRs that need a code review label Dec 6, 2021
@bx80 bx80 linked an issue Jan 4, 2022 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rendering performance improvement for reports with many rows
2 participants