Skip to content

Commit a8d5eca

Browse files
AlpAlp
authored andcommitted
chore: remove internal patch reference comments
1 parent 328c34e commit a8d5eca

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/zql/src/ivm/memory-source.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,11 @@ export type Connection = {
8484
| undefined;
8585
readonly debug?: DebugDelegate | undefined;
8686
lastPushedEpoch: number;
87+
/** Pre-computed on connect so #fetch avoids re-deriving it every call. */
8788
pkConstraint: Constraint | undefined;
89+
/** Per-connection cache of constraint+sort -> Index to skip Map lookups. */
8890
indexCache: Map<string, Index>;
91+
/** Stringified sort key for this connection, cached to build index cache keys cheaply. */
8992
requestedSortKey: string;
9093
};
9194

@@ -101,6 +104,7 @@ export class MemorySource implements Source {
101104
readonly #columns: Record<string, SchemaValue>;
102105
readonly #primaryKey: PrimaryKey;
103106
readonly #primaryIndexSort: Ordering;
107+
/** Cached JSON key for the primary index to avoid repeated JSON.stringify. */
104108
readonly #primaryIndexKey: string;
105109
readonly #indexes: Map<string, Index> = new Map();
106110
readonly #connections: Connection[] = [];
@@ -270,7 +274,6 @@ export class MemorySource implements Source {
270274
const connectionComparator = (r1: Row, r2: Row) =>
271275
compareRows(r1, r2) * (req.reverse ? -1 : 1);
272276

273-
// Patch 7: Use cached pkConstraint from connection instead of recomputing
274277
const pkConstraint = conn.pkConstraint;
275278
// The primary key constraint will be more limiting than the constraint
276279
// so swap out to that if it exists.
@@ -295,7 +298,6 @@ export class MemorySource implements Source {
295298
indexSort.push(...requestedSort);
296299
}
297300

298-
// Patch 4: Cache index lookup per connection
299301
let constraintShapeKey = '';
300302
if (fetchOrPkConstraint) {
301303
for (const key of Object.keys(fetchOrPkConstraint)) {

0 commit comments

Comments
 (0)