GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — perf(server): checkpoint capture scans the index listing by record in… · incognitojam/styal@bc58367

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • apps/server/src/vcs
    • GitVcsDriver.test.ts
    • GitVcsDriver.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎apps/server/src/vcs/GitVcsDriver.test.ts‎

Copy file name to clipboardExpand all lines: apps/server/src/vcs/GitVcsDriver.test.ts
+9-5Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -682,9 +682,13 @@ it.effect.each(
682682
}).pipe(Effect.scoped, Effect.provide(layerGitContract)),
683683
);
684684

685-
it.effect.each(["normal", "flags", "sparse"] as const)(
686-
"checkpoint index inspection handles entries beyond the output cap (index=%s)",
687-
(indexMode) =>
685+
it.effect.each(
686+
(["normal", "flags", "sparse"] as const).flatMap((indexMode) =>
687+
[1, 3, 4096].map((chunkSize) => ({ indexMode, chunkSize })),
688+
),
689+
)(
690+
"checkpoint index inspection handles entries beyond the output cap (index=$indexMode, chunk=$chunkSize)",
691+
({ indexMode, chunkSize }) =>
688692
Effect.gen(function* () {
689693
const fs = yield* FileSystem.FileSystem;
690694
const path = yield* Path.Path;
@@ -720,8 +724,8 @@ it.effect.each(["normal", "flags", "sparse"] as const)(
720724
...input,
721725
maxOutputBytes: 8,
722726
onStdoutChunk: (chunk) => {
723-
for (let i = 0; i < chunk.length; i++)
724-
input.onStdoutChunk?.(chunk.subarray(i, i + 1));
727+
for (let i = 0; i < chunk.length; i += chunkSize)
728+
input.onStdoutChunk?.(chunk.subarray(i, i + chunkSize));
725729
},
726730
}
727731
: input,
Collapse file

‎apps/server/src/vcs/GitVcsDriver.ts‎

Copy file name to clipboardExpand all lines: apps/server/src/vcs/GitVcsDriver.ts
+22-14Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -915,7 +915,7 @@ export const makeVcsDriverShape = Effect.fn("makeGitVcsDriverShape")(function* (
915915
let specialFlags = false;
916916
let recordStart = true;
917917
let skipped = false;
918-
let skippedRecord: number[] = [];
918+
let skippedRecord: Uint8Array[] = [];
919919
const skippedPaths: string[] = [];
920920
yield* vcsProcess.run({
921921
operation,
@@ -925,27 +925,35 @@ export const makeVcsDriverShape = Effect.fn("makeGitVcsDriverShape")(function* (
925925
env: commitEnv,
926926
maxOutputBytes: 4_096,
927927
outputMode: "truncate",
928+
// Only tags and sparse skip-worktree paths matter; scan NUL-delimited records.
928929
onStdoutChunk: (chunk) => {
929-
for (const byte of chunk) {
930-
if (recordStart) skipped = byte === 83;
930+
let start = 0;
931+
while (start < chunk.length) {
932+
const end = chunk.indexOf(0, start);
933+
if (recordStart) {
934+
const tag = chunk[start]!;
935+
skipped = tag === 83;
936+
if ((tag >= 97 && tag <= 122) || (!sparseCheckout && tag === 83)) {
937+
specialFlags = true;
938+
}
939+
}
931940
if (skipped && sparseCheckout) {
932-
if (byte !== 0) skippedRecord.push(byte);
933-
else {
934-
if (skippedRecord.at(-1) !== 47) {
935-
const name = Buffer.from(skippedRecord).subarray(2);
941+
skippedRecord.push(
942+
Buffer.from(chunk.subarray(start, end === -1 ? undefined : end)),
943+
);
944+
if (end !== -1) {
945+
const record = Buffer.concat(skippedRecord);
946+
if (record.at(-1) !== 47) {
947+
const name = record.subarray(2);
936948
if (!NodeBuffer.isUtf8(name)) specialFlags = true;
937949
else skippedPaths.push(name.toString("utf8"));
938950
}
939951
skippedRecord = [];
940952
}
941953
}
942-
if (
943-
recordStart &&
944-
((byte >= 97 && byte <= 122) || (!sparseCheckout && byte === 83))
945-
) {
946-
specialFlags = true;
947-
}
948-
recordStart = byte === 0;
954+
recordStart = end !== -1;
955+
if (!recordStart) break;
956+
start = end + 1;
949957
}
950958
},
951959
});

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.