perf(views/js): route indexed views through selectIndexedViewRows and avoid iterableReferences copy (#13775)

This commit is contained in:
morluto authored and GitHub committed 2026-11-23 00:54:13 +00:00
1 parent 4a62303717
commit 819d046e60
6 files changed
+100 -82

No files matched your search

+12 -9
View File
@@ -17,7 +17,7 @@ import {
completeWithinViewCoverage,
pageViewCoverage,
} from "./analysisViewCoverage.js";
import { selectViewRows } from "./selectViewRows.js";
import { selectIndexedViewRows, selectViewRows } from "./selectViewRows.js";
const code = pythonPycSchema.shape.code_objects.element;
@@ -110,6 +110,8 @@ export const projectPythonPycView = (
),
source_index,
});
const matches = (row: PythonPycCodeObject) =>
names === undefined || names.has(row.name);
const selected =
names === undefined && indices === undefined
? {
@@ -118,14 +120,15 @@ export const projectPythonPycView = (
.map((row, index) => projectRow(row, view.offset + index)),
total: code_objects.length,
}
: selectViewRows(
code_objects,
view,
(row, index) =>
(names === undefined || names.has(row.name)) &&
(indices === undefined || indices.has(index)),
projectRow,
);
: indices !== undefined
? selectIndexedViewRows(
code_objects,
indices,
view,
matches,
projectRow,
)
: selectViewRows(code_objects, view, matches, projectRow);
return ok({
...shared,
kind: "python-pyc" as const,