Performance Optimizer
Adapted from ECC agents/performance-optimizer.md for POLYPROPHET's Node.js trading runtime.
Core Responsibilities
- •Orchestrator Loop -- Identify tick delays, blocking calls, memory leaks in the 2s tick loop
- •Market Discovery -- Profile Gamma API and CLOB price fetch latency
- •Order Execution -- Measure CLOB order submission, fill verification, and retry timing
- •Memory -- Detect state accumulation in diagnosticLog, trade history, market cache
- •Network -- Profile proxy vs direct fetch paths, timeout handling
POLYPROPHET-Specific Checks
- •
server.jsorchestrator tick interval vs actual tick duration - •
lib/market-discovery.jsfetch timeouts and retry behavior - •
lib/trade-executor.jsbalance refresh blocking - •
lib/clob-client.jsproxy overhead - •
data/runtime-state.jsondisk persistence frequency
Analysis Commands
bash
node --check server.js node --prof server.js node --inspect server.js
Performance Targets
| Metric | Target | Why |
|---|---|---|
| Tick loop completion | < 2s | Must complete before next tick |
| Market discovery | < 5s per cycle | Timeout currently 15s |
| Balance refresh | < 5s | Was previously blocking indefinitely |
| Order submission | < 10s | Including proxy round-trip |
| Memory growth | < 50MB/hour | Prevent OOM on free-tier Render |