Make It Faster make-it-faster
Run after any major feature add or milestone to find and land measured improvements in runtime performance, React rendering, Worker/DO overhead, bundle size, and build/check/test speed across the Vibestack stack.
- Our test
- —
- not tested yet
- GitHub stars
- 20k
- elizaos/eliza
- Added by
- 0
- members
- Updated
- Dec 6
- commit e932464
- Content
- 1 file
- no scripts · 10 KB
- License
- MIT
- free to use
What our test found
Not tested yet. Our model tries every skill on a realistic request and scores the result, the most popular skills first. Until then, the safety checks on the right still apply.
name: make-it-faster description: "Run after any major feature add or milestone to find and land measured improvements in runtime performance, React rendering, Worker/DO overhead, bundle size, and build/check/test speed across the Vibestack stack."
Make it faster
Run this pass after a major feature add, milestone, or performance-sensitive change, once correctness is green. Read in full first, once per session.
Optimization without measurement is guessing. Vet every baseline and speedup with and : name the real limiter before editing, ship only changes that earn their complexity, and prove each win with before/after evidence and green gates.
Phase 0: Gate and baseline
- Start from green. Run
pnpm verifywhen defined, otherwisepnpm check,pnpm lint, andpnpm analyze(when present). Ifpnpm checkshows a✗, follow first. - Choose scope. Skip generated and build directories (
gen/,generated/,dist/,.vibe/,.cache/,.spec-cache/,node_modules/). - Feature / PR pass (default): changed files (
git diff --name-only <base>...HEAD), their owningspec/modules, direct callers, hot paths, emitted client chunks, and Turbo tasks they touch. - Full pass (app finish or major milestone): every active package, runtime entrypoint, production bundle, and workspace task.
- Measure before editing. Capture reproducible baselines for the affected dimensions (end-to-end latency/throughput, render frame cost, production bundle bytes,
pnpm build/pnpm check/pnpm testwall time), write down the threshold that would justify a change, and identify the limiter from a real profile or build artifact per . - If a benchmark will be rerun across edits or PRs, add it as a typed
--jsonscript in the owning package'spackage.json() rather than an ad-hoc script.
Phase 1: Profile and audit the four surfaces
Inspect only surfaces relevant to the scope; on large passes, audit independent surfaces in parallel. Always inspect real runtime profiles, browser traces, dist/ outputs, or Turbo dry-runs instead of guessing from source alone.
1. Runtime and shell (VibeLang, Effect 4, SQLite Durable Objects, Cloudflare Workers)
- SQLite DO and database queries: eliminate N+1 queries in loops, missing indexes on frequent
WHERE/ORDER BY/ join columns, unbatched row-by-row writes that belong in one transaction, full-table scans on DO wake, and oversizedstored(key)/decodeStateblobs rewritten on every tick. - Network and RPC waterfalls: parallelize independent
tryI/O calls with bounded Effect concurrency (Effect.all/Effect.forEachwith{ concurrency }), batch chatty Worker ↔ DO or API round-trips, and stream large payloads instead of buffering them in memory. - Boundary serialization and hot-path allocations: parse and decode untrusted data once at system boundaries (); remove redundant
JSON.parse/JSON.stringify,structuredClone, or re-decoding on trusted internal paths; hoistIntl.*,RegExp, and parser/formatter instantiation out of hot loops. - Machine churn and persistence writes: cut redundant
Machine.senddispatches (no-op events, duplicate submits, polling loops) that trigger needlesskeep/storedwrites or wakechangessubscribers. - Memory, leaks, and Worker cold starts: bound every in-memory
Map/Set/cache with explicit eviction and invalidation; revokeblob:URLs; pairStream.callback/FiberMapresources withaddFinalizer/acquireRelease; strip eager top-level work or heavy imports from Worker entrypoints to protect isolate cold-start and CPU budgets; ensure Alchemy CLI invocations setALCHEMY_FAST_DISTILLED=1().
2. React rendering and UI responsiveness
Respect : never add useEffect or setTimeout workarounds, and never duplicate spec-owned state outside Machine ().
- Selective `Machine` subscriptions: replace broad
useMachine(runtime)calls on hot or wide subtrees withuseMachine(runtime, select, equals?)oruseMachineSelector(runtime, select, equals?)fromgen/<name>.react.ts, and avoid subscribing one component to many whole machines. - Render work and reference stability: move expensive sorting, filtering, or formatting off repeated render paths; stabilize object, array, and callback references passed into heavy subtrees; keep high-frequency transient UI drafts (typing, pointer drag, open menus) in local
useStateuntil committed instead of dispatchingMachineevents at 60Hz. - Lists, layout, and paint: virtualize or paginate large lists/tables; eliminate interleaved DOM reads and writes causing forced synchronous reflow; fix unstable
keyprops that remount subtrees; animate compositor-only properties (transform,opacity) while honoringprefers-reduced-motion; set explicit media dimensions to prevent layout shift, lazy-load offscreen media (loading="lazy"), and subset/preload critical fonts.
3. Bundle size and delivery (Vite, Tailwind v4, Workers Static Assets)
- Inspect real build output: run
pnpm buildand measure emitteddist/chunks (raw and compressed) and their largest modules. - Shrink the initial client chunk: remove accidental server/Node modules, broad Effect/platform imports, or heavy chart/editor/utility libraries from the initial entry; code-split heavy or rare routes and panels behind dynamic
import()with a non-blank fallback. - Tree-shaking and dependencies: keep workspace root barrels (
"."inexports) required by , while flagging impure module top-levels blocking tree-shaking ("sideEffects": falsewhere pure), eager re-exports of optional heavy features inside app files, and duplicate dependency versions inpnpm-lock.yaml. - Assets, CSS, and edge delivery: trim unused font weights/subsets and oversized SVGs/images; keep CSS confined to design tokens and Tailwind v4 utilities; verify Cloudflare deploys use the single-build handoff (
bundle: false+hashAssetDirectoryin ) so unchanged assets are neither double-built nor re-uploaded.
4. Build, check, and test speed (Turborepo, Vite, VibeLang, Vitest, pnpm check)
Per , a small edit must rerun only what it touches, and a full run should stay as fast as possible.
- Turborepo graph and caching (`turbo.json`): check
pnpm exec turbo run <task> --dry=jsonfor overly broadinputs(tests, docs,.DS_Store,.alchemy/,.wrangler/,.spec-cache/, generated files) poisoningbuildorgencaches, missingoutputs, needless task edges serializing parallel work, or volatile env vars leaking into cache keys instead ofpassThroughEnvon uncached tasks. - Typecheck, Vite, and lint latency: keep
deploy/andalchemy.run.tsisolated indeploy/tsconfig.jsonand ESLint'suntypedlist () sopnpm lint:jsstays fast and never OOMs; tighten widetsconfig.jsonscopes and eliminate redundant build steps. - Test and check loop: consolidate Vitest journeys repeating heavy database/server/DOM setup instead of sharing helpers or extending existing journeys (); avoid Chromium (
pnpm test:browser) for behavior already proved by the spec or covered in Node; preserve.spec-cache/and Vitest receipts rather than bypassing them; tune sluggish Quint simulation (weight_or wide<param>Values) only without weakening any rule ().
Phase 2: Triage and apply in verifiable units
Rank opportunities by measured end-to-end impact against added complexity:
| Priority | Act on | |---|---| | High | User-visible latency or jank, Worker CPU/memory/cold-start bottlenecks, bloated initial client chunks, broken Turbo or pnpm check cache invalidation | | Medium | Hot-path allocations or redundant serialization, chatty internal RPCs, secondary chunk splits, duplicated heavy test setup | | Skip | Cold-path micro-optimizations, gains inside the measurement noise floor, or caches whose invalidation complexity outweighs a small win () |
Apply one optimization hypothesis per unit () so each measurement isolates what moved the number.
Never trade away correctness or stack rules: never edit gen/, .spec-cache/, .studio/, or spec/lock.json; never weaken a spec rule, proof, or test; never add useEffect, setTimeout, code comments, a second state library, or new Markdown reports; never break root barrel exports.
Phase 3: Re-measure and verify gates
- Prove every win. Re-run the baseline comparison under . Revert any change whose effect is within run-to-run variation, fails to move the end-to-end metric, or does not earn its complexity.
- Confirm every relevant gate is green:
pnpm check(follow if any spec changed),pnpm lintandpnpm analyze(when defined),pnpm test:browserplus a quick check in the running build for UI/rendering changes,pnpm test:deploywhen Workers, Durable Objects, static assets, oralchemy.run.tschanged.
Report
Summarize concisely when done:
- Scope and baselines: surfaces audited, baseline numbers, named limiters, and gate status.
- Verified wins: each change with
file:line, metric, before → after (median, range, run count), and limiter moved. - Reverted or skipped: measured no-ops or ideas rejected for complexity.
- Remaining bottlenecks: structural limiters or tradeoffs needing user input, or state explicitly that none remain.