陈大猫
3998add458
perf(memory): Phase 3 deep business-code memory optimization across main, renderer, and active terminals
Completes exhaustive business-code memory optimization stacked on Phase 1-2 (#4476),
reaching the business-code floor before Electron-level optimization:
Round 1 - Renderer Cold Start & Preload Minification:
- Enable esbuild minification in scripts/build-preload.mjs (368 KB -> 103 KB, -72%)
- Remove eager requestIdleCallback TerminalLayer mount in AppMounts.tsx
- Add compact capability lookup maps to toolNameIndex.json so permissionGrants drops
static cattyToolSpecs.json (126 KB) from startup
- Lazy-load pinyin-pro (447 KB) on first CJK text via usePinyinMatcherVersion hook
(synchronous createRequire in Node/test mode, zero top-level await)
Round 2 & 3 - Main Process & terminalWorker Zero-Dead-Weight Startup:
- Lazy-load all third-party npm packages on startup (0 npm packages loaded at boot;
require.cache 657 -> 234 modules, -64.4%; main heapTotal 54 -> 23.3 MiB):
ajv/ajv-formats/plugin-contract schema, electron-updater, jsqr, ws, webmDurationPatch,
terminalPerformanceDiagnostics, ssh2, ssh2-sftp-client, iconv-lite, zmodem.js,
node-pty/serialport (Electron-gated so Node Module._load mocks stay 100% intact),
11 AI SDK drivers, CodexAppServerRuntime, codebuddy, aiPrivacyService, re2js,
external MCP setup, 17 capability modules, and 7 systemManager/*Ops modules
- Clean up windowManager readiness/unhealthy maps on BrowserWindow closed
Round 4 - Renderer Startup Bundle Decomposition:
- Lazy-load HostDetailsPanel (134 KB), GroupDetailsPanel (29 KB), KnownHostsManager,
QuickConnectWizard, SerialConnectModal, Serial/LocalHostDetailsPanel,
ImportVaultDialog, VaultImportProgressPanel, domain/vaultImport (55 KB),
TerminalHostTreeSidebar (35 KB), ToolCall (26 KB), vaultAgentBridgeClient (47 KB)
- Tree-shake package.json in cloudSync (-32 KB from useUpdateCheck)
- Main App-*.js chunk: 1,550 KB -> 714.6 KB (-53.9%)
Round 5 - Active Multi-Terminal Memory Optimization:
- Remove unconditional requestIdleCallback preload of AIChatSidePanel (~1.5 MB JS /
vendor-ai + globalAgentRuntime + tool specs) in TerminalLayerSupport.tsx
- Remove eager 67-spec Fig autocomplete preloading (1.25 MB raw JS imported into
main-process ESM cache + renderer specCache) in useTerminalAutocomplete.ts; specs
load on demand via completionEngine.ts loadSpec()
Verified Clean-VM Benchmarks (0-host idle, 3x median, vs Blank Electron 97.6 MiB PrivDirty):
- Total Private Dirty RAM: 324.8 -> 234.6 (Phase 1-2) -> 184.2 MiB (-43.3%, 61.9% of
all Netcatty overhead above Blank Electron eliminated)
- Renderer v8/main/heap: 24.84 -> 9.35 MiB (-62.4%); jsHeapUsedMB: 35.98 -> 12.76 MiB
(only +3.22 MiB above about:blank)
- Active 5 local terminals + 1,000-line ANSI burst: Peak PrivDirty -25.6 MiB
(395.9 -> 370.3 MiB), main PrivDirty -11.3 MiB, renderer PrivDirty -14.2 MiB,
zero xterm/canvas/listener/per-session heap leaks across 2x5 open/close cycles
2026-11-27 10:04:36 +00:00
..
2026-11-25 22:18:12 +08:00
2026-10-20 21:06:54 +08:00
2026-11-07 19:17:55 +08:00
2026-07-30 22:33:31 +08:00
2026-08-07 10:25:57 +00:00
2026-08-07 10:25:57 +00:00
2026-10-29 19:32:02 -07:00
2026-10-29 19:32:02 -07:00
2026-11-22 11:53:02 +08:00
2026-11-22 11:53:02 +08:00
2026-08-07 14:40:38 +08:00
2026-05-28 15:12:19 +08:00
2026-10-27 20:26:21 -07:00
2026-10-27 20:26:21 -07:00
2026-11-05 22:20:24 +08:00
2026-11-05 22:20:24 +08:00
2026-11-25 21:39:31 +08:00
2026-11-25 21:39:31 +08:00
2026-08-15 02:17:44 +08:00
2026-08-14 23:06:21 +08:00
2026-05-27 00:03:08 +08:00
2026-11-25 21:39:31 +08:00
2026-11-25 21:39:31 +08:00
2026-08-07 14:40:38 +08:00
2026-11-23 11:00:14 +08:00
2026-08-06 11:33:18 +08:00
2026-08-05 17:39:13 +08:00
2026-08-07 14:37:37 +00:00
2026-08-18 16:30:30 +08:00
2026-06-23 01:49:57 +08:00
2026-06-23 01:49:57 +08:00
2026-05-22 22:26:05 +08:00
2026-05-22 22:26:05 +08:00
2026-07-27 18:58:34 +08:00
2026-07-30 16:32:42 +08:00
2026-09-03 15:21:45 +08:00
2026-09-03 15:21:45 +08:00
2026-11-06 12:09:38 +08:00
2026-11-25 22:04:01 +08:00
2026-10-15 18:00:43 +08:00
2026-10-15 18:00:43 +08:00
2026-08-07 14:37:37 +00:00
2026-08-07 14:37:37 +00:00
2026-07-29 21:04:16 +08:00
2026-11-23 11:00:14 +08:00
2026-08-05 17:39:13 +08:00
2026-08-06 08:53:19 +08:00
2026-07-03 10:47:59 +08:00
2026-08-06 13:17:24 +08:00
2026-10-08 18:11:23 +08:00
2026-11-23 11:00:14 +08:00
2026-09-12 10:55:36 +08:00
2026-09-12 10:55:36 +08:00
2026-07-29 15:45:13 +08:00
2026-07-29 12:47:23 +08:00
2026-10-08 18:11:23 +08:00
2026-10-08 18:11:23 +08:00
2026-10-08 18:11:23 +08:00
2026-10-24 10:36:35 +08:00
2026-10-24 10:36:35 +08:00
2026-10-08 18:11:23 +08:00
2026-10-20 12:41:41 +08:00
2026-11-27 08:48:48 +00:00
2026-08-22 12:28:01 +08:00
2026-10-24 19:56:53 +08:00
2026-10-24 19:56:53 +08:00
2026-10-17 02:26:36 +08:00
2026-10-17 02:26:36 +08:00
2026-11-23 11:00:14 +08:00
2026-11-23 11:00:14 +08:00
2026-06-10 11:04:36 +08:00
2026-07-30 10:43:48 +08:00
2026-10-20 13:15:32 +08:00
2026-05-28 15:12:19 +08:00
2026-10-17 15:05:30 +08:00
2026-11-04 01:11:25 -08:00
2026-11-04 01:11:25 -08:00
2026-09-18 15:19:34 +08:00
2026-09-18 15:19:34 +08:00
2026-07-29 11:11:14 +08:00
2026-08-07 14:38:24 +00:00
2026-08-07 14:38:24 +00:00
2026-08-18 09:53:42 +08:00
2026-08-18 09:53:42 +08:00
2026-11-07 16:08:00 +08:00
2026-11-07 16:08:00 +08:00
2026-11-26 17:52:27 +08:00
2026-11-26 17:52:27 +08:00
2026-07-26 02:10:37 +08:00
2026-08-05 18:43:10 +08:00
2026-10-26 17:07:41 +00:00
2026-11-23 18:42:03 +08:00
2026-10-26 16:07:10 +00:00
2026-10-26 16:07:10 +00:00
2026-07-28 00:54:03 +08:00
2026-07-28 00:54:03 +08:00
2026-07-20 12:39:29 +08:00
2026-10-28 23:08:31 -07:00
2026-10-28 23:08:31 -07:00
2026-10-28 23:08:31 -07:00
2026-07-29 03:33:00 +08:00
2026-07-29 03:33:00 +08:00
2026-11-25 21:39:51 +08:00
2026-11-25 21:39:51 +08:00
2026-07-20 22:40:48 +08:00
2026-07-20 22:40:48 +08:00
2026-10-26 19:35:41 +00:00
2026-10-26 09:32:00 +00:00
2026-10-28 23:08:31 -07:00
2026-10-28 23:08:31 -07:00
2026-07-20 12:39:29 +08:00
2026-07-20 12:39:29 +08:00
2026-10-28 23:08:31 -07:00
2026-11-26 17:52:27 +08:00
2026-11-25 22:03:02 +08:00
2026-07-20 12:39:29 +08:00
2026-07-20 12:39:29 +08:00
2026-11-26 18:52:09 +08:00
2026-11-26 18:52:09 +08:00
2026-06-03 10:27:50 +08:00
2026-06-03 10:27:50 +08:00
2026-11-24 14:53:22 +08:00
2026-11-24 14:53:22 +08:00
2026-05-26 02:42:41 +08:00
2026-05-26 02:42:41 +08:00
2026-04-28 21:21:46 +08:00
2026-04-28 21:21:46 +08:00
2026-10-15 11:43:32 +08:00
2026-10-15 11:43:32 +08:00
2026-09-30 09:57:47 +08:00
2026-11-23 11:00:14 +08:00
2026-06-28 23:48:12 +08:00
2026-07-30 16:47:44 +08:00
2026-07-30 16:32:42 +08:00
2026-03-26 21:52:10 +08:00
2026-07-30 19:11:40 +08:00
2026-08-08 02:56:37 +00:00
2026-07-09 11:16:41 +08:00
2026-10-15 14:13:46 +08:00
2026-10-15 14:44:11 +08:00
2026-11-26 23:46:58 +08:00
2026-11-23 11:00:14 +08:00
2026-11-23 11:00:14 +08:00
2026-10-22 22:15:21 +08:00
2026-10-22 22:15:21 +08:00
2026-11-24 10:50:25 +08:00
2026-11-24 10:50:25 +08:00
2026-10-15 18:05:45 +08:00
2026-06-17 18:43:50 +08:00
2026-07-30 22:48:16 +08:00
2026-07-30 22:48:16 +08:00
2026-06-17 18:43:42 +08:00
2026-06-17 18:43:42 +08:00
2026-11-26 23:46:58 +08:00
2026-11-26 23:46:58 +08:00
2026-11-25 10:48:00 +08:00
2026-11-25 10:48:00 +08:00
2026-08-07 14:37:37 +00:00
2026-09-27 21:14:53 +08:00
2026-09-18 14:10:33 +08:00
2026-11-26 23:46:58 +08:00
2026-10-20 13:53:52 +08:00
2026-10-26 11:46:08 +00:00
2026-11-26 23:46:58 +08:00
2026-11-24 10:52:54 +08:00
2026-11-18 15:18:54 +08:00
2026-11-24 10:52:54 +08:00
2026-09-07 10:30:42 +08:00
2026-07-30 17:28:16 +08:00
2026-11-23 11:00:14 +08:00
2026-06-12 14:00:16 +08:00
2026-07-30 16:10:08 +08:00
2026-07-30 16:10:08 +08:00
2026-06-28 03:28:50 +08:00
2026-09-01 19:58:55 +08:00
2026-11-25 21:38:33 +08:00
2026-05-31 18:01:43 +08:00
2026-06-11 14:48:52 +08:00
2026-08-10 16:59:39 +08:00
2026-08-10 16:59:39 +08:00
2026-09-01 20:12:36 +08:00
2026-10-27 16:21:07 +08:00
2026-10-27 16:21:07 +08:00
2026-11-24 10:52:25 +08:00
2026-11-26 23:46:58 +08:00
2026-10-15 14:13:46 +08:00
2026-10-15 14:13:46 +08:00
2026-11-05 23:44:37 +08:00
2026-11-05 23:44:37 +08:00
2026-11-24 10:50:14 +08:00
2026-11-24 10:50:14 +08:00
2026-11-05 23:44:37 +08:00
2026-11-05 23:44:37 +08:00
2026-06-14 01:30:44 +08:00
2026-08-04 00:20:54 +08:00
2026-08-04 00:20:54 +08:00
2026-10-24 19:24:39 +08:00
2026-10-24 19:24:39 +08:00
2026-06-10 01:10:33 +08:00
2026-11-25 22:02:42 +08:00
2026-11-25 22:02:42 +08:00
2026-08-12 00:08:29 +08:00
2026-06-24 23:36:32 +08:00
2026-11-23 11:00:14 +08:00
2026-10-29 19:32:02 -07:00
2026-10-29 19:32:02 -07:00
2026-09-07 14:32:08 +08:00
2026-09-07 14:32:08 +08:00
2026-11-14 21:36:08 +08:00
2026-08-07 14:37:37 +00:00
2026-10-28 23:08:31 -07:00
2026-10-28 23:08:31 -07:00
2026-09-25 17:35:49 +08:00
2026-09-25 17:35:49 +08:00
2026-05-01 16:31:58 +08:00
2026-05-01 16:31:58 +08:00
2026-06-12 01:21:28 +08:00
2026-06-12 01:21:28 +08:00
2026-07-03 10:47:59 +08:00
2026-09-03 11:29:18 +08:00
2026-11-25 22:03:54 +08:00
2026-11-25 22:04:01 +08:00
2026-08-07 14:40:38 +08:00
2026-09-29 14:51:22 +08:00
2026-08-07 14:40:38 +08:00
2026-11-25 11:25:00 +08:00
2026-06-26 00:08:39 +08:00
2026-11-25 22:03:38 +08:00
2026-11-27 00:47:59 +08:00
2026-11-23 16:46:35 +08:00
2026-11-22 11:53:02 +08:00
2026-11-05 22:20:24 +08:00
2026-11-05 22:20:24 +08:00
2026-08-24 15:22:57 +08:00
2026-11-25 22:03:38 +08:00
2026-11-05 22:20:24 +08:00
2026-08-04 00:55:00 +08:00
2026-08-18 17:24:46 +08:00
2026-11-04 00:22:10 -08:00
2026-11-04 00:22:10 -08:00
2026-08-18 17:24:46 +08:00
2026-11-04 01:11:25 -08:00
2026-10-18 12:58:36 +08:00
2026-10-18 12:58:36 +08:00
2026-09-30 00:38:50 +08:00
2026-06-01 19:29:53 +08:00
2026-09-07 10:30:30 +08:00
2026-10-15 19:33:12 +08:00
2026-09-07 10:30:30 +08:00
2026-09-07 10:30:30 +08:00
2026-09-27 14:57:10 +08:00
2026-09-27 14:57:10 +08:00
2026-11-25 17:29:32 +08:00
2026-10-15 18:00:43 +08:00
2026-10-15 18:00:43 +08:00
2026-11-25 11:22:00 +08:00
2026-11-25 11:22:00 +08:00
2026-11-26 22:32:32 +08:00
2026-11-26 23:02:34 +08:00
2026-10-08 18:11:23 +08:00
2026-08-12 16:42:43 +08:00
2026-08-12 16:42:43 +08:00
2026-11-25 22:02:35 +08:00
2026-11-25 22:02:35 +08:00
2026-06-07 19:05:33 +08:00
2026-10-20 13:52:32 +08:00
2026-11-25 11:18:18 +08:00
2026-10-08 17:50:41 +08:00
2026-10-08 17:50:41 +08:00
2026-10-18 02:20:18 +08:00
2026-10-18 02:20:18 +08:00
2026-10-22 18:14:06 +08:00
2026-10-22 18:14:06 +08:00
2026-11-26 23:46:58 +08:00
2026-11-26 23:46:58 +08:00
2026-11-26 23:42:04 +08:00
2026-10-15 14:13:46 +08:00
2026-10-15 14:13:46 +08:00
2026-07-12 15:53:32 +08:00
2025-12-13 01:38:44 +08:00
2026-10-17 22:43:37 +08:00
2026-07-07 23:29:14 +08:00
2026-07-07 23:29:14 +08:00
2026-09-27 18:03:09 +08:00
2026-09-27 18:03:09 +08:00
2026-06-28 03:28:50 +08:00
2026-11-26 22:32:23 +08:00
2026-11-26 22:32:23 +08:00
2026-10-27 23:54:58 -07:00
2026-10-17 15:05:30 +08:00
2026-11-26 23:46:58 +08:00
2026-11-25 22:02:35 +08:00
2026-10-18 04:19:55 +08:00
2026-07-29 11:11:14 +08:00
2026-08-12 12:04:42 +08:00
2026-08-12 12:04:42 +08:00
2026-11-27 10:04:36 +00:00
2026-11-04 03:19:21 -08:00
2026-11-25 21:38:54 +08:00
2026-07-27 13:55:43 +08:00
2026-07-27 13:55:43 +08:00
2026-10-27 12:18:27 +00:00
2026-10-26 05:26:25 +00:00
2026-10-26 14:02:00 +00:00
2026-10-28 16:32:41 +08:00
2026-07-26 02:10:37 +08:00
2026-07-20 12:39:29 +08:00
2026-07-20 12:39:29 +08:00
2026-11-25 21:39:02 +08:00
2026-11-25 21:39:02 +08:00
2026-11-07 07:10:08 +08:00
2026-11-26 17:52:27 +08:00
2026-11-23 18:42:03 +08:00
2026-07-28 00:54:03 +08:00
2026-10-26 15:00:54 +00:00
2026-10-26 07:39:37 +00:00
2026-10-28 23:08:31 -07:00
2026-10-27 02:28:08 +00:00
2026-07-20 12:39:29 +08:00
2026-07-20 12:39:29 +08:00
2026-10-28 23:08:31 -07:00
2026-10-26 13:15:52 +00:00
2026-09-12 11:55:36 +08:00
2026-09-12 11:55:36 +08:00
2026-11-23 11:00:14 +08:00
2026-07-23 09:42:47 +08:00
2026-07-23 09:42:47 +08:00
2026-11-25 21:38:40 +08:00
2026-10-26 11:46:08 +00:00
2026-10-26 17:00:56 +00:00
2026-07-28 00:54:03 +08:00
2026-11-25 21:38:54 +08:00
2026-11-25 21:39:02 +08:00
2026-11-25 22:03:02 +08:00
2026-08-07 14:40:38 +08:00
2026-08-07 14:40:38 +08:00
2026-11-25 11:20:42 +08:00
2026-11-25 11:20:42 +08:00
2026-11-25 22:02:35 +08:00
2026-08-08 02:50:41 +00:00
2026-11-25 22:02:35 +08:00
2026-11-26 23:34:09 +08:00
2026-11-26 23:34:09 +08:00
2026-06-10 23:19:31 +08:00
2026-07-30 16:47:44 +08:00
2026-09-18 15:19:34 +08:00
2026-09-18 15:19:34 +08:00
2026-11-25 22:02:35 +08:00
2026-11-25 22:02:35 +08:00
2026-10-18 13:20:06 +08:00
2026-10-22 22:15:21 +08:00
2026-07-30 22:48:16 +08:00
2026-11-07 19:17:55 +08:00
2026-11-07 19:17:55 +08:00
2026-11-06 17:07:16 +08:00
2026-11-25 11:18:18 +08:00
2026-11-25 10:48:00 +08:00
2026-11-26 23:46:58 +08:00
2026-10-24 11:08:28 +08:00
2026-09-29 16:06:18 +08:00
2026-11-07 19:17:55 +08:00
2026-11-04 02:11:09 -08:00
2026-08-12 11:44:35 +08:00
2026-10-20 13:52:32 +08:00
2026-11-26 23:46:58 +08:00
2026-11-25 10:03:10 +08:00
2026-11-25 22:18:12 +08:00
2026-03-28 19:44:37 +08:00
2026-07-29 03:33:00 +08:00
2026-11-25 11:26:13 +08:00
2026-08-11 12:15:44 +00:00
2026-11-04 00:22:10 -08:00
2026-11-25 22:04:01 +08:00
2026-11-25 22:04:01 +08:00
2026-09-05 00:11:52 +08:00
2026-09-05 00:11:52 +08:00
2026-08-24 18:32:56 +08:00
2026-08-24 18:32:56 +08:00
2026-08-21 08:18:01 +08:00
2026-08-21 08:18:01 +08:00
2026-01-28 11:13:17 +08:00
2026-09-29 18:01:04 +08:00
2026-10-20 21:06:54 +08:00
2026-08-07 14:40:38 +08:00
2026-11-22 11:53:02 +08:00
2026-11-24 10:50:36 +08:00
2026-07-27 14:50:26 +08:00
2026-11-26 23:46:58 +08:00
2026-11-25 15:52:30 +08:00
2026-11-27 00:04:37 +08:00
2026-08-12 00:08:29 +08:00
2026-08-11 23:57:57 +08:00
2026-07-22 08:58:58 +08:00
2026-11-25 21:38:40 +08:00
2026-10-24 19:57:00 +08:00
2026-08-07 14:38:24 +00:00
2026-10-27 20:59:11 -07:00
2026-10-27 20:59:11 -07:00
2026-10-28 23:08:31 -07:00
2026-09-12 13:47:34 +08:00
2026-06-09 03:35:03 +08:00
2026-08-07 14:37:37 +00:00
2026-09-29 12:22:35 +08:00
2026-11-27 10:04:36 +00:00
2026-10-16 10:38:15 +08:00
2026-10-16 10:38:15 +08:00
2026-10-16 10:38:15 +08:00
2026-10-16 10:38:15 +08:00
2026-08-07 14:40:38 +08:00
2026-11-27 10:04:36 +00:00
2026-10-26 23:16:06 +08:00
2026-10-27 10:11:05 -07:00
2026-11-26 23:46:58 +08:00
2026-06-11 03:11:39 +08:00
2026-11-25 10:44:22 +08:00
2026-11-25 10:44:22 +08:00
2026-07-21 16:51:03 +08:00
2026-08-05 09:53:37 +08:00
2026-08-12 22:00:18 +08:00
2026-08-12 22:00:18 +08:00
2026-08-12 22:00:18 +08:00
2026-09-25 15:27:24 +08:00
2026-07-28 00:54:03 +08:00
2026-08-18 11:44:18 +08:00
2026-07-28 00:54:03 +08:00
2026-07-28 00:54:03 +08:00
2026-07-28 00:54:03 +08:00
2026-07-28 00:54:03 +08:00
2026-09-12 11:53:24 +08:00
2026-11-26 23:46:58 +08:00
2026-07-28 00:54:03 +08:00
2026-06-28 23:48:12 +08:00
2026-07-28 00:54:03 +08:00
2026-07-28 00:54:03 +08:00
2026-09-07 14:32:08 +08:00
2026-09-07 14:32:08 +08:00
2026-08-07 10:25:54 +00:00
2026-08-07 10:25:54 +00:00
2026-10-15 18:00:43 +08:00
2026-10-15 18:00:43 +08:00
2026-08-23 22:56:36 +08:00
2026-08-23 22:56:36 +08:00
2026-06-26 18:01:57 +08:00
2026-10-15 18:03:47 +08:00
2026-10-15 18:03:47 +08:00
2026-09-21 15:45:59 +08:00
2026-07-04 17:38:33 +08:00
2026-07-04 17:38:33 +08:00