Skip to content
Source
Sign inSign up
pingdotgg/t3code

feat(server): make workspace list cap configurable #5107

ClosedFuzzyma(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/5107/headopened View on GitHub

Showing 4 changed files with 230 additions and 1 deletion (loading 2).

x
0 of 4 viewed, 4 left
118 additions and 0 deletionsapps/server/scripts/workspace-index-memory-probe.tsAdded
View file
@@ -0,0 +1,118 @@
+// @effect-diagnostics nodeBuiltinImport:off - Standalone Node performance probe.
+import * as NodeChildProcess from "node:child_process";
+import * as NodeProcess from "node:process";
+​
+import * as Effect from "effect/Effect";
+​
+import * as WorkspaceSearchIndex from "../src/workspace/WorkspaceSearchIndex.ts";
+​
+const DEFAULT_LIMITS = [1_000, 5_000, 25_000];
+const CHILD_FLAG = "--child";
+​
+interface MemorySample {
+ readonly maxEntries: number;
+ readonly returnedEntries: number;
+ readonly truncated: boolean;
+ readonly indexedRssMiB: number;
+ readonly listedRssMiB: number;
+ readonly listDeltaRssMiB: number;
+ readonly indexedPeakRssMiB: number;
+ readonly listedPeakRssMiB: number;
+ readonly listPeakDeltaRssMiB: number;
+}
+​
+function memorySample(): { readonly rssMiB: number; readonly peakRssMiB: number } {
+ globalThis.gc?.();
+ return {
+ rssMiB: Math.round((NodeProcess.memoryUsage().rss / 1024 / 1024) * 10) / 10,
+ peakRssMiB: Math.round((NodeProcess.resourceUsage().maxRSS / 1024) * 10) / 10,
+ };
+}