-
-
Notifications
You must be signed in to change notification settings - Fork 128
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
Improve datagrid performance #394
Conversation
@@ -2146,7 +2144,7 @@ export class DataGrid extends Widget { | |||
} | |||
|
|||
// 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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🕵️ 🔍 🐜
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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/datagrid
is 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
TODO
messages - 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 😻 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! 🚀
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.