-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Fix a number of perf issues with large notebooks #7778
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
Conversation
Change updates to not update full cell Change global properties to be per cell Change cells to check for updates before rendering
Some perf fixes for monaco editor. Skip laying out parent etc until necessary
Fix markdown editor background
// Indicate not showing the editor anymore. The equivalent of this | ||
// is not when we receive focus but when we GIVE focus to the markdown editor | ||
// otherwise we wouldn't be able to display it. | ||
this.setState({showingMarkdownEditor: false}); |
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.
This should be unnecessary as I changed the logic here. It uses the props to determine if showing the markdown editor or not. I'm going to remove this and make sure markdown editing still works #Resolved
} else { | ||
cellVMs[i] = cloneDeep(cellVM); | ||
cellVMs[i].useQuickEdit = false; | ||
cellVMs[i] = immutable.merge(cellVM, { useQuickEdit: false }); |
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.
merge [](start = 51, length = 5)
crap, this is wrong. Merge is unnecessary here. #Resolved
Codecov Report
@@ Coverage Diff @@
## master #7778 +/- ##
==========================================
+ Coverage 58.75% 59.17% +0.42%
==========================================
Files 496 498 +2
Lines 22158 22245 +87
Branches 3570 3573 +3
==========================================
+ Hits 13019 13164 +145
+ Misses 8321 8259 -62
- Partials 818 822 +4
Continue to review full report at Codecov.
|
const cellVM = this.state.cellVMs.find(c => c.cell.id === cellId); | ||
if (cellVM) { | ||
const index = this.findCellIndex(cellId); | ||
if (index >= 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.
Is it right here to be recomputing selection and focus if the deleted cell is either selected or focused? Will focused context ever not be in the selected cell? #WontFix
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.
You mean the or statement? (this.pendingState.selectedCell === cellId || this.pendingState.focusedCell === cellId)?
The second half of this should always be true if the first half is, but it's just in case the logic gets messed up somewhere else.
In reply to: 332125334 [](ancestors = 332125334)
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.
Yeah, I wasn't sure if that was a tautology or not.
Like via this:
if (newSelect >= 0) {
newVMs[newSelect] = { ...newVMs[newSelect], selected: true, focused: focusedCell === newVMs[newSelect].cell.id };
}
In reply to: 332129126 [](ancestors = 332129126,332125334)
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.
Oh we only want to change it if the selected item is the item being deleted, so it would be more like this:
if (newSelection === cellId)
In reply to: 332130707 [](ancestors = 332130707,332129126,332125334)
const content = this.isMarkdownCell() && !this.isShowingMarkdownEditor() ? | ||
<div className='cell-result-container'> | ||
<div className='cell-row-container'> | ||
{this.renderCollapseBar(false)} |
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.
This lets you delete a cell without selecting it? #WontFix
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.
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.
Still a little confused with what's going on.
Thats primarily due to lack of domain knowledge.
Added a few comments, approving as they aren't show stoppers.
Adding a few comments in some places should address most of my concerns.
src/client/datascience/interactive-common/intellisense/baseIntellisenseProvider.ts
Show resolved
Hide resolved
// Return our changes | ||
changes = [ | ||
{ | ||
range: this.createSerializableRange(new Position(0, 0), new Position(0, 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.
Wouldn't it be better to create a custom serializer/transformer. If tomorrow we forget to use this, then we wouldn't know exactly what wen't wrong. Or if another class has the same problem as Position
.
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.
Sorry don't have the foggiest what you're referring to. You mean the function createSerializableRange?
In reply to: 332128183 [](ancestors = 332128183)
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.
Yes. I'm assuming we are using createSerializableRange
, because JSON.stringify
faills or puts a lot of unwanted guff.
hideOutput={cellVM.hideOutput} | ||
focusCell={this.focusCell} | ||
selectCell={this.selectCell} | ||
lastCell={lastLine !== null} |
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.
Wouldn't it be more efficient to track the selected cellId
instead of the object!
Same applies to focusCell
, selectedCell
, lastCell
#WontFix
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.
Will improve overall perf in react too, as they are simple strings that are being passed around. #WontFix
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.
Those values are the cell id. They're not the objects.
In reply to: 332130854 [](ancestors = 332130854)
src/client/datascience/interactive-common/intellisense/intellisenseDocument.ts
Show resolved
Hide resolved
src/client/datascience/interactive-common/interactiveWindowTypes.ts
Outdated
Show resolved
Hide resolved
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.
* First idea - load cells all at once. Change updates to not update full cell Change global properties to be per cell Change cells to check for updates before rendering * Fix delete to not select at the same time * Make a pending state and a rendered state to use for rendering Some perf fixes for monaco editor. Skip laying out parent etc until necessary * Refactor intellisense to not take so much time on load * More delete and move fixes for intellisense * Fix markdown not switching Fix markdown editor background * Fix some of the time on first render * Add some more unit tests and fix intellisense issue * Add news entry and fix variable explorer open * Remove unnecessary state change * Remove unnecessary merge * Comment change * Postpone widget parent changes * Add new dependency * Update some comments and names to be clearer
For #7483
Made a number of adjustments to increase perf
Added some more unit tests for the intellisense changes.
There's still a bunch of work left to do though. We need to virtualize the monaco editors somehow as they are the big bottleneck on opening now. A notebook with 500 cells in it takes 10 seconds just to show the first render. Resizing after that requires 5 seconds after resizing the window to calm down.