Performance Optimization
Achieve optimal performance with SAMMY Three’s built-in optimization strategies and worker-based architecture.Overview
SAMMY Three is designed for high performance with multiple optimization layers working together.Worker Architecture
Offload heavy processing to background workers
Audio-Aware Capture
Intelligent throttling during audio playback
Critical Renders
Automatic capture at conversation boundaries
Worker Architecture
SAMMY Three uses multiple workers to prevent main thread blocking.Worker Types
- Canvas Worker
- Observability Worker
- DOM Capture Workers
Handles image encoding and compression.Operations:
- JPEG/PNG encoding
- Image compression
- Resolution scaling
- Format conversion
Worker Benefits
Non-Blocking UI
Main thread remains responsive during heavy operations
Parallel Processing
Multiple operations execute simultaneously
Automatic Fallback
Gracefully degrades to main thread if workers unavailable
CSP Compliance
Uses Data URLs instead of blob URLs for security
Audio-Aware Capture
Screen capture automatically adapts based on audio state to prevent stuttering.How It Works
Normal Mode
When: No audio playing
- High-frequency captures (100ms-2s)
- Full quality rendering
- Maximum detail capture
Audio Mode
When: Agent speaking
- Reduced captures (500ms-5s)
- Optimized quality
- Prevents audio stuttering
Configuration
Critical DOM Renders
Ensures fresh visual context at important conversation moments.Automatic Triggers
Critical renders happen automatically at:Speech Boundaries
- User starts speaking
- User stops speaking
- Agent starts response
- Agent completes response
Interruptions
- User interrupts agent
- Agent pauses for user
- Conversation direction changes
State Changes
- Page navigation
- Major UI updates
- Form submissions
- Modal opens/closes
Benefits
Agent always has current visual context
No stale UI information during conversations
Captures happen even when regular capture is throttled
Minimal performance impact with smart timing
Memory Management
Optimize memory usage for long-running sessions.Automatic Cleanup
Manual Optimization
Capture Optimization
Quality Settings
Balance quality and performance based on your needs.Capture Methods Comparison
Method | CPU Usage | Quality | Best For |
---|---|---|---|
render | Low-Medium | High | Web applications |
video | Medium-High | Variable | Full screen capture |
Use
render
method for most web applications. It’s more efficient and provides consistent quality.Performance Debugging
Audio Stutter Analysis
Debug and fix audio performance issues.Performance Monitoring
Optimization Strategies
Device-Based Configuration
Adjust settings based on device capabilities.Network Optimization
Reduce bandwidth usage for slow connections.Best Practices
Profile First: Use browser DevTools to identify bottlenecks before optimizing
Start Conservative: Begin with lower quality settings and increase as needed
Monitor Metrics: Track performance in production to catch issues early
Test on Target Devices: Always test on actual devices your users will use
Use Workers: Keep worker mode enabled unless you have specific reasons not to
Batch Operations: Group multiple operations together when possible
Performance Benchmarks
Expected Performance
Metric | Good | Acceptable | Poor |
---|---|---|---|
Capture Time | < 50ms | 50-150ms | > 150ms |
Audio Latency | < 100ms | 100-300ms | > 300ms |
Memory Usage | < 50MB | 50-150MB | > 150MB |
CPU Usage | < 30% | 30-60% | > 60% |
FPS (during capture) | > 30 | 15-30 | < 15 |
Optimization Checklist
- Initial Setup
- Fine-Tuning
- Production
- Enable worker mode
- Configure audio adaptation
- Set appropriate quality
- Test on target devices
- Monitor initial metrics