Skip to content
1 change: 1 addition & 0 deletions news/2 Fixes/10971.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix perf problems after running the interactive window for an extended period of time.
2 changes: 1 addition & 1 deletion src/client/datascience/cellFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export function hasCells(document: TextDocument, settings?: IDataScienceSettings
}

// CellRange is used as the basis for creating new ICells. We only use it in this file.
interface ICellRange {
export interface ICellRange {
range: Range;
title: string;
cell_type: string;
Expand Down
48 changes: 0 additions & 48 deletions src/client/datascience/editor-integration/cellhashLogger.ts

This file was deleted.

30 changes: 8 additions & 22 deletions src/client/datascience/editor-integration/cellhashprovider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@ import { noop } from '../../common/utils/misc';
import { getCellResource } from '../cellFactory';
import { CellMatcher } from '../cellMatcher';
import { Identifiers } from '../constants';
import { InteractiveWindowMessages, SysInfoReason } from '../interactive-common/interactiveWindowTypes';
import {
ICell,
ICellHash,
ICellHashListener,
ICellHashProvider,
IFileHashes,
IInteractiveWindowListener
INotebookExecutionLogger
} from '../types';

interface IRangedCellHash extends ICellHash {
Expand All @@ -35,7 +34,7 @@ interface IRangedCellHash extends ICellHash {
// This class provides hashes for debugging jupyter cells. Call getHashes just before starting debugging to compute all of the
// hashes for cells.
@injectable()
export class CellHashProvider implements ICellHashProvider, IInteractiveWindowListener {
export class CellHashProvider implements ICellHashProvider, INotebookExecutionLogger {
// tslint:disable-next-line: no-any
private postEmitter: EventEmitter<{ message: string; payload: any }> = new EventEmitter<{
message: string;
Expand Down Expand Up @@ -71,25 +70,6 @@ export class CellHashProvider implements ICellHashProvider, IInteractiveWindowLi
return this.postEmitter.event;
}

// tslint:disable-next-line: no-any
public onMessage(message: string, payload?: any): void {
switch (message) {
case InteractiveWindowMessages.AddedSysInfo:
if (payload && payload.type) {
const reason = payload.type as SysInfoReason;
if (reason !== SysInfoReason.Interrupt) {
this.hashes.clear();
this.executionCount = 0;
this.updateEventEmitter.fire();
}
}
break;

default:
break;
}
}

public getHashes(): IFileHashes[] {
return [...this.hashes.entries()]
.map((e) => {
Expand All @@ -101,6 +81,12 @@ export class CellHashProvider implements ICellHashProvider, IInteractiveWindowLi
.filter((e) => e.hashes.length > 0);
}

public onKernelRestarted() {
this.hashes.clear();
this.executionCount = 0;
this.updateEventEmitter.fire();
}

public async preExecute(cell: ICell, silent: boolean): Promise<void> {
try {
if (!silent) {
Expand Down
Loading