# Playwright MCP Performance Comparison Guide
## Batch Processing Performance Measurement
### Why Batch Processing is Effective
1. **Reduction in API Calls**
- Original: 5 MCP API calls
- Fast (Batch): 2 MCP API calls
2. **Reduction in Response Tokens**
- Reduces redundant information per command (headers, footers, state information)
- Bulk exclusion of unnecessary information with globalExpectation
3. **Reduced Execution Time**
- Reduces round-trip time between commands
- Internally optimized execution
### Specific Comparison Example
#### Sequential (Original Playwright MCP)
```
Command 1: navigate
Response: [Full browser state + snapshot + tabs + console]
Command 2: click
Response: [Full browser state + snapshot + tabs + console]
Command 3: wait
Response: [Full browser state + snapshot + tabs + console]
Command 4: navigate_back
Response: [Full browser state + snapshot + tabs + console]
Command 5: snapshot
Response: [Full browser state + snapshot + tabs + console]
Total: 5 responses × ~2000 tokens = ~10,000 tokens
```
#### Batch (Fast Playwright MCP)
```
Command 1: batch_execute (with globalExpectation: no snapshots)
Response: [Summary + minimal step results]
Command 2: snapshot
Response: [Full browser state + snapshot]
Total: 1 summary + 1 full response = ~3,000 tokens
```
### Expected Improvements
1. **Token Reduction**: 60-70% reduction
2. **Execution Time**: 40-50% reduction
3. **API Calls**: 60% reduction (5→2)
## Measurement Methods
### Manual Measurement
1. Execute each command
2. Save responses to text files
3. Count characters (token count ≈ character count ÷ 4)
4. Record execution time
### Semi-automatic Measurement
```bash
# Response size comparison
wc -c original-response.txt fast-response.txt
# Token count estimation
echo "Original tokens: $(($(wc -c < original-response.txt) / 4))"
echo "Fast tokens: $(($(wc -c < fast-response.txt) / 4))"
```
## Batch Processing Best Practices
1. **Group Similar Operations**
- Navigation operations
- Form input operations
- Validation operations
2. **Utilize globalExpectation**
```javascript
globalExpectation: {
includeSnapshot: false, // No intermediate snapshots needed
includeConsole: false, // No console output needed
includeCode: true, // Execution code needed
includeTabs: false // No tab information needed
}
```
3. **Final Snapshot Only**
- Get only final state after batch execution
- Use partial snapshots as needed