avoid creating a copy of an array of entire view to look up index

Summary: What title says

Reviewed By: lblasa

Differential Revision: D46275672

fbshipit-source-id: 65c6566a042b576b83ababdf6470ddf2f626d3e4
This commit is contained in:
Anton Kastritskiy
2023-05-30 08:01:18 -07:00
committed by Facebook GitHub Bot
parent 230c31b548
commit ff6b0043c4

View File

@@ -585,7 +585,7 @@ export class DataSourceView<T, KeyType> {
}
getViewIndex(entry: T): number {
return this.output(0, Infinity).indexOf(entry);
return this._output.findIndex((x) => x.value === entry);
}
public setWindow(start: number, end: number) {