nb diff perf improvements by comparing hash values (#227145)
* nb diff perf improvements by comparing hash values * More efficientpull/227144/head
parent
f6d9f0edf5
commit
e674b3a0b5
|
@ -1644,7 +1644,7 @@ export class ModifiedElement extends AbstractElementRenderer {
|
|||
{
|
||||
updateInfoRendering: () => renderSourceEditor(),
|
||||
checkIfModified: (cell) => {
|
||||
return cell.modified?.textModel.getValue() !== cell.original?.textModel.getValue() ? { reason: undefined } : false;
|
||||
return cell.modified?.textModel.getTextBufferHash() !== cell.original?.textModel.getTextBufferHash() ? { reason: undefined } : false;
|
||||
},
|
||||
getFoldingState: (cell) => cell.cellFoldingState,
|
||||
updateFoldingState: (cell, state) => cell.cellFoldingState = state,
|
||||
|
@ -1660,7 +1660,7 @@ export class ModifiedElement extends AbstractElementRenderer {
|
|||
const scopedContextKeyService = this.contextKeyService.createScoped(this.templateData.inputToolbarContainer);
|
||||
this._register(scopedContextKeyService);
|
||||
const inputChanged = NOTEBOOK_DIFF_CELL_INPUT.bindTo(scopedContextKeyService);
|
||||
inputChanged.set(this.cell.modified.textModel.getValue() !== this.cell.original.textModel.getValue());
|
||||
inputChanged.set(this.cell.modified.textModel.getTextBufferHash() !== this.cell.original.textModel.getTextBufferHash());
|
||||
|
||||
const ignoreWhitespace = NOTEBOOK_DIFF_CELL_IGNORE_WHITESPACE.bindTo(scopedContextKeyService);
|
||||
const ignore = this.textConfigurationService.getValue<boolean>(this.cell.modified.uri, 'diffEditor.ignoreTrimWhitespace');
|
||||
|
@ -1675,7 +1675,7 @@ export class ModifiedElement extends AbstractElementRenderer {
|
|||
const refreshToolbar = () => {
|
||||
const ignore = this.textConfigurationService.getValue<boolean>(this.cell.modified.uri, 'diffEditor.ignoreTrimWhitespace');
|
||||
ignoreWhitespace.set(ignore);
|
||||
const hasChanges = this.cell.modified.textModel.getValue() !== this.cell.original.textModel.getValue();
|
||||
const hasChanges = this.cell.modified.textModel.getTextBufferHash() !== this.cell.original.textModel.getTextBufferHash();
|
||||
inputChanged.set(hasChanges);
|
||||
|
||||
if (hasChanges) {
|
||||
|
|
|
@ -443,7 +443,7 @@ function createDiffViewModels(instantiationService: IInstantiationService, confi
|
|||
case 'unchanged': {
|
||||
const originalCell = originalModel.cells[diff.originalCellIndex];
|
||||
const modifiedCell = modifiedModel.cells[diff.modifiedCellIndex];
|
||||
const type = (originalCell.textModel?.getValue() !== modifiedCell.textModel?.getValue()) ? 'modified' : 'unchanged';
|
||||
const type = originalCell.equal(modifiedCell) ? 'unchanged' : 'modified';
|
||||
return new SideBySideDiffElementViewModel(
|
||||
model.modified.notebook,
|
||||
model.original.notebook,
|
||||
|
|
|
@ -419,6 +419,10 @@ export class NotebookCellTextModel extends Disposable implements ICell {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (this.outputs.length !== b.outputs.length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.getTextLength() !== b.getTextLength()) {
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue