Dag performance profiler

From curiositech/windags-skills · View interactive version

Dag performance profiler is an AI agent skill from the GitHub repository curiositech/windags-skills. Profiles DAG execution performance including latency, token usage, cost, and resource consumption. Identifies bottlenecks and optimization opportunities. Activate on 'performance profile', 'execution metrics', 'latency analysis', 'token usage', 'cost analysis'. NOT for execution tracing (use dag-exe

How to use this skill

Skill file

DAG Performance Profiler

You analyze DAG execution performance to identify bottlenecks and optimization opportunities through systematic profiling of latency, token usage, cost, and resource consumption.

DECISION POINTS

1. Bottleneck Classification

Primary bottleneck detected?
├─ High latency (>3x avg node time)
│  ├─ Sequential dependency chain → Restructure for parallelization
│  └─ Single slow node → Break into smaller tasks or downgrade model
├─ High cost (>40% of total budget)
│  ├─ Token usage >5000/node → Context reduction strategy
│  └─ Expensive model overuse → Model selection optimization
└─ Resource contention (wait time >50% execution time)
   ├─ Tool latency bottleneck → Cache or parallelize tool calls
   └─ Dependency blocking → DAG restructuring

2. Optimization Priority Matrix

Impact vs Effort analysis:
├─ High Impact (>20% improvement) + Low Effort → IMMEDIATE (same day)
│  ├─ Model downgrade for simple tasks → Execute immediately
│  └─ Remove obvious sequential dependencies → Execute immediately
├─ High Impact + High Effort → PLANNED (next sprint)
│  ├─ Major DAG restructuring → Schedule with stakeholders
│  └─ Tool replacement/caching → Plan implementation
├─ Low Impact (<10% improvement) → DEFER
│  └─ Minor optimizations → Document but don't implement
└─ Negative Impact → REJECT
   └─ Optimizations that hurt other metrics → Explicitly reject

3. Cost-Latency Trade-off Decision

Performance requirement context?
├─ Cost-sensitive (budget constrained)
│  ├─ Accept 20% latency increase for 30%+ cost reduction → Recommend
│  └─ <20% cost savings → Keep current configuration
├─ Latency-critical (real-time requirements)
│  ├─ Accept 40%+ cost increase for 20% latency reduction → Recommend
│  └─ <15% latency improvement → Reject cost increase
└─ Balanced requirements
   ├─ Cost/latency ratio improvement >15% → Recommend
   └─ <10% improvement either metric → No change recommended

FAILURE MODES

Over-Optimization Syndrome

Symptoms: Recommending micro-optimizations that save <5% while ignoring major bottlenecks

Detection: If optimization list has >5 items with <10% individual impact each

Fix: Rank by impact percentage, focus only on top 2-3 optimizations with >15% impact. Defer others explicitly.

False Bottleneck Attribution

Symptoms: Misidentifying wait time as execution bottleneck, blaming wrong nodes

Detection: If "slow node" has high wait time but normal execution time relative to task complexity

Fix: Separate wait time from execution time in analysis. Focus on dependency structure causing waits, not node speed.

Cost Underestimation Trap

Symptoms: Providing token savings calculations without accounting for model pricing differences

Detection: If cost savings percentages don't match token reduction ratios by model type

Fix: Always calculate actual cost: (token_change / 1000) × model_price_per_1k. Show both token AND dollar impact.

Parallelization Fantasy

Symptoms: Suggesting parallelization for inherently sequential tasks with data dependencies

Detection: If recommending parallel execution for nodes where output of A feeds input of B

Fix: Map actual data dependencies before suggesting parallelization. Only truly independent nodes can run parallel.

Single-Metric Tunnel Vision

Symptoms: Optimizing one metric while catastrophically degrading another

Detection: If optimizing for cost increases latency >50% or optimizing latency increases cost >100%

Fix: Always provide trade-off analysis: "20% cost savings, 15% latency increase, 5% accuracy impact"

WORKED EXAMPLES

Code Review DAG Analysis

Initial State: 5-node code review DAG: 45s total, $0.42 cost

Step 1 - Bottleneck Classification

Primary bottleneck: review-performance at 12.4s (27% of total) - Single slow node pattern

Secondary: Dependency blocking causing 12.6s total wait time

Step 2 - Apply Decision Tree

High latency bottleneck + resource contention → Restructure for parallelization + break down slow node

Step 3 - Optimization Recommendations

  1. HIGH IMPACT: Split review-performance into check-patterns (3s, Sonnet) + assess-complexity (4s, Sonnet)
  1. MEDIUM IMPACT: Parallelize analyze-complexity + check-security (currently sequential)
  1. DEFER: Context reduction could save $0.05 but <5% impact

Final Result: 28s total (38% faster), $0.34 cost (19% cheaper)

High-Cost Analytics Pipeline

Initial State: 8-node data analysis: 67s total, $2.40 cost, 95% Opus usage

Step 1 - Cost Analysis Discovery

Step 2 - Model Selection Decision Tree

Using complexity assessment:

Step 3 - Impact Calculation

Expert Decision: Accept trade-off - massive cost savings for minimal latency impact in non-critical analytics pipeline.

QUALITY GATES

Performance profiling complete when:

NOT-FOR BOUNDARIES

This skill should NOT be used for:

Delegate when:

This skill focuses on analysis and actionable recommendations, not monitoring, design, or automatic implementation.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.