Skip to content
Source
Sign inSign up
pingdotgg/t3code

perf(mobile): reuse encoded rows in shell cache saves #16129

Mergedjuliusmarmingemerged 1 commit intot3code/mobile-perf/lazy-thread-move-availability fromrefs/pull/16129/headmerged by juliusmarminge View on GitHub

Showing 3 changed files with 121 additions and 31 deletions.

x
0 of 3 viewed, 3 left
72 additions and 3 deletionsapps/mobile/src/connection/environment-cache-store.test.tsModified
View file
@@ -25,7 +25,7 @@
​
import * as MobileDatabase from "../persistence/mobile-database";
import { make } from "./environment-cache-store";
-import { encodeStoredShellSnapshot } from "./shell-cache-encoding";
+import { makeStoredShellSnapshotEncoder } from "./shell-cache-encoding";
​
const ENVIRONMENT_ID = EnvironmentId.make("environment-1");
const PROJECT_ID = ProjectId.make("project-1");
@@ -409,6 +409,9 @@
});
​
describe("cooperative shell cache encoding", () => {
+ // A fresh encoder per call keeps these cases cold; the cache has its own cases below.
+ const encodeStoredShellSnapshot = (stored: typeof StoredOrchestrationShellSnapshot.Type) =>
+ makeStoredShellSnapshotEncoder()(stored);
const encodeOriginal = Schema.encodeEffect(
Schema.fromJsonString(StoredOrchestrationShellSnapshot),
@@ -511,8 +514,10 @@
...stored,
snapshot: {
...stored.snapshot,
- threads: Array.from({ length: 65 }, () => stored.snapshot.threads[0]!),
- archivedThreads: Array.from({ length: 33 }, () => stored.snapshot.archivedThreads[0]!),
+ threads: Array.from({ length: 65 }, () => ({ ...stored.snapshot.threads[0]! })),
+ archivedThreads: Array.from({ length: 33 }, () => ({
+ ...stored.snapshot.archivedThreads[0]!,