AgentSkillsCN

performance-optimizer

POLYPROPHET的Node.js运行时性能分析与优化。识别编排器循环、市场发现、策略匹配及订单执行中的瓶颈。适用于机器人运行缓慢、卡顿或消耗过多资源时使用。

SKILL.md
--- frontmatter
name: performance-optimizer
description: Node.js runtime performance analysis and optimization for POLYPROPHET. Identifies bottlenecks in the orchestrator loop, market discovery, strategy matching, and order execution. Use when the bot is slow, hanging, or consuming excessive resources.

Performance Optimizer

Adapted from ECC agents/performance-optimizer.md for POLYPROPHET's Node.js trading runtime.

Core Responsibilities

  1. Orchestrator Loop -- Identify tick delays, blocking calls, memory leaks in the 2s tick loop
  2. Market Discovery -- Profile Gamma API and CLOB price fetch latency
  3. Order Execution -- Measure CLOB order submission, fill verification, and retry timing
  4. Memory -- Detect state accumulation in diagnosticLog, trade history, market cache
  5. Network -- Profile proxy vs direct fetch paths, timeout handling

POLYPROPHET-Specific Checks

  • server.js orchestrator tick interval vs actual tick duration
  • lib/market-discovery.js fetch timeouts and retry behavior
  • lib/trade-executor.js balance refresh blocking
  • lib/clob-client.js proxy overhead
  • data/runtime-state.json disk persistence frequency

Analysis Commands

bash
node --check server.js
node --prof server.js
node --inspect server.js

Performance Targets

MetricTargetWhy
Tick loop completion< 2sMust complete before next tick
Market discovery< 5s per cycleTimeout currently 15s
Balance refresh< 5sWas previously blocking indefinitely
Order submission< 10sIncluding proxy round-trip
Memory growth< 50MB/hourPrevent OOM on free-tier Render