# Codeman Performance Optimization Plan ## Current State The backend is **already production-grade** — SSE broadcasting, state persistence, terminal batching, buffer management, and memory patterns are all well-optimized. The biggest gains are on the **frontend delivery** side. ## Implemented Optimizations ### 1. V8 Compile Cache (10-20% faster cold start) **Files:** `scripts/codeman-web.service`, `package.json` Node.js re-parses and compiles all JS on every cold start. `NODE_COMPILE_CACHE` caches V8 compiled bytecode to disk, reusing it on subsequent starts. - Added `Environment=NODE_COMPILE_CACHE=/home/arkon/.codeman/compile-cache` to systemd service - Added to `npm start` script for non-systemd usage - Zero code changes, immediate win on every restart ### 2. WebGL Addon Lazy-Loading (244KB saved on mobile, non-blocking on desktop) **Files:** `src/web/public/index.html`, `src/web/public/app.js` `xterm-addon-webgl.min.js` (244KB) was loaded eagerly for all users via `