Improve datagrid performance#394
Conversation
|
|
||
| // Test whether there is content to blit. | ||
| let needBlit = curH > 0 && curH > 0 && width > 0 && height > 0; | ||
| let needBlit = curW > 0 && curH > 0 && width > 0 && height > 0; |
resize(Column|Row|ColumnHeader|RowHeader)
6c4f9ae to
31de83b
Compare
|
This is the diff for the API: diff --git a/review/api/datagrid.api.md b/review/api/datagrid.api.md
index 9197a504..ebd1c1c3 100644
--- a/review/api/datagrid.api.md
+++ b/review/api/datagrid.api.md
@@ -131,16 +131,11 @@ export interface CellGroup {
export namespace CellGroup {
export function areCellGroupsIntersecting(group1: CellGroup, group2: CellGroup): boolean;
export function areCellGroupsIntersectingAtAxis(group1: CellGroup, group2: CellGroup, axis: 'row' | 'column'): boolean;
- // (undocumented)
- export function areCellsMerged(dataModel: DataModel, rgn: DataModel.CellRegion, cell1: number[], cell2: number[]): boolean;
- export function calculateMergeOffsets(dataModel: DataModel, regions: DataModel.CellRegion[], axis: 'row' | 'column', sectionList: SectionList, index: number): [number, number, CellGroup];
export function getCellGroupsAtColumn(dataModel: DataModel, rgn: DataModel.CellRegion, column: number): CellGroup[];
export function getCellGroupsAtRegion(dataModel: DataModel, rgn: DataModel.CellRegion): CellGroup[];
export function getCellGroupsAtRow(dataModel: DataModel, rgn: DataModel.CellRegion, row: number): CellGroup[];
export function getGroup(dataModel: DataModel, rgn: DataModel.CellRegion, row: number, column: number): CellGroup | null;
export function getGroupIndex(dataModel: DataModel, rgn: DataModel.CellRegion, row: number, column: number): number;
- export function isCellGroupAbove(group1: CellGroup, group2: CellGroup): boolean;
- export function isCellGroupBelow(group1: CellGroup, group2: CellGroup): boolean;
export function joinCellGroups(groups: CellGroup[]): CellGroup;
export function joinCellGroupsIntersectingAtAxis(dataModel: DataModel, regions: DataModel.CellRegion[], axis: 'row' | 'column', group: CellGroup): CellGroup;
export function joinCellGroupWithMergedCellGroups(dataModel: DataModel, group: CellGroup, region: DataModel.CellRegion): CellGroup;@afshin @blink1073 do you think that's a problem? I can add those back and add a DeprecationWarning if that helps the PR get merged. |
|
A bi-product of this PR is that it fixes a rendering issue when shrinking cells that are at the same level as a merged cell:
before_issue.mp4
after_issue.mp4 |
|
Removing them seems reasonable to me since datagrid is still pre-1.0. |
Thanks for your answer! I updated the API file |
There was a problem hiding this comment.
Nice work tracking down the performance issue and resolving it, @martinRenou!
I think we can merge this and iterate because:
- This is a pre-1.0 package (although, perhaps we should consider jumping straight to 2.0 to be in line with the rest of the library)
@lumino/datagridis downstream of the other packages
But we should make sure that before the final version we address:
- refactoring with a
type PaintRegion - implementing and removing the
TODOmessages - potentially de-duplicating the slightly different but very similar loops
Definitely 👍🏽 Maybe @ibdafna would like to give this a try before we merge? As he implemented the merge cells logic and knows what to test etc to make sure everything works nicely. |
|
Thank you for this @martinRenou, I will test tomorrow evening and report
back. I have no doubt this is working incredibly well! 🙏
…On Fri, Sep 9, 2022, 08:59 martinRenou ***@***.***> wrote:
But we should make sure that before the final version we address:
- refactoring with a type PaintRegion
- implementing and removing the TODO messages
- potentially de-duplicating the slightly different but very similar
loops
Definitely 👍🏽
Maybe @ibdafna <https://github.com/ibdafna> would like to give this a try
before we merge? As he implemented the merge cells logic and knows what to
test etc to make sure everything works nicely.
—
Reply to this email directly, view it on GitHub
<#394 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AFZICWMZELDW4KKGRPZURADV5LN6ZANCNFSM6AAAAAAQGUO24U>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
127.0.0.1_8080.and.1.more.page.-.Personal.-.Microsoft.Edge.2022-09-11.08-23-26.mp4@martinRenou I see some issues with border rendering when scrolling x/y axes (video attached) |
|
Thanks for trying! I haven't seen those. I will try to replicate. |
|
I can indeed replicate in the base example (the issue was not appearing in my custom grid for some reason). I will investigate :) |
This is fixed by 32952d7. The issue was that I was taking into account the x-scroll level for the column header and the y-scroll level for the row header while this should not be the case (headers are sticky, not following the scroll). |
|
LGTM! Let's ship it!! ♥💘💖💗💓💙💚💛❤🖤🧡💜 |
It appears that when slowly scrolling merged cells, the area considered "clean" is actually not really clean if a merged group is intersected by that area. Redrawing those groups fixes it.
|
Thanks!! I actually found another issue when slowly scrolling. 830e094 seems to fix that issue.
The improvement suggested by @afshin gets more urgent to fix as it's now 6 loops that are quite similar, but I can do it in a separate PR if that's fine. |
|
I'd love to see this released this week 😻 |
cc. @ibdafna
This PR improves the performance of the grid by reworking the drawing of merged cells logic.
before.mp4
after.mp4
Note for the tester: You will see a big difference in performance if you zoom out a lot and show a lot of cells.