3x Faster: How Teams Chat Backup v3.3 Improved Performance
Speed matters when you're backing up thousands of Microsoft Teams messages. What used to take 10 minutes now takes 3. Teams Chat Backup v3.3 introduced major performance optimizations that make backups up to 3 times faster while using less memory and being more reliable.
The Performance Challenge
Why Backups Were Slow
When backing up a Teams chat, the extension must:
- Scroll through the entire conversation (could be thousands of messages)
- Extract message data from the DOM (author, timestamp, content, images)
- Download file attachments from SharePoint/OneDrive
- Convert images to base64 for storage
- Generate PDF with screenshots (if not using Turbo Mode)
- Save to IndexedDB for later viewing
In a typical chat with 1,000 messages, that means ~50,000 DOM queries, ~20 image conversions, ~10 file downloads, and ~200 screenshots for PDF. All these operations add up.
The Bottlenecks
We identified three major performance bottlenecks:
- DOM queries: Repeated selector lookups (~8 seconds per 1,000 messages)
- File downloads: Serial one-at-a-time downloads (~30 seconds)
- Duplicate detection: O(n²) array operations (~5 seconds)
Total overhead: ~43 seconds just for these operations.
The Solutions
1. DOM Query Caching
Problem: Every time the extension needed to find the chat container, it ran 15+ different CSS selectors to locate it. This happened hundreds of times during backup.
Solution: Cache the result for 5 seconds. After first lookup, subsequent lookups return the cached container instantly.
Results:
- Cache hit rate: ~95%
- Time saved: ~6 seconds per 1,000 messages
- Cache auto-invalidates on chat switch or new backup
2. Parallel File Downloads
Problem: File attachments were downloaded one at a time. A chat with 10 files would wait for each download to complete before starting the next.
Solution: Download up to 3 files in parallel using concurrent promises.
Results:
- Downloads run in parallel (3 at a time)
- 3x faster for chats with multiple attachments
- 10 files: ~30 seconds → ~10 seconds
3. O(n) Duplicate Detection
Problem: When merging new messages into existing backups, duplicate checking used array.some(), which is O(n²) complexity.
Solution: Use Set for constant-time lookups instead of array scanning.
Results:
- 1,000x faster for large chats
- Time saved: ~4 seconds per 1,000 messages
4. Parallel Image Conversion
Problem: Converting blob URLs to base64 happened sequentially, one image at a time.
Solution: Convert all images in parallel using Promise.all().
Results:
- ~5x faster for chats with many images
- 20 images: ~10 seconds → ~2 seconds
Performance Benchmarks
Real-World Test Results
We tested the same chats before and after v3.3 optimizations:
| Chat Type | Messages | Before | After | Improvement |
|---|---|---|---|---|
| Small chat | 100 | 45s | 20s | 2.25x faster |
| Medium chat | 500 | 3m 15s | 1m 30s | 2.17x faster |
| Large chat | 1,000 | 8m 30s | 2m 50s | 3x faster |
| Very large | 2,500 | 25m | 8m | 3.1x faster |
Memory Optimizations
Blob URL Memory Leak Fix
Problem: Blob URLs created for screenshots and file downloads were never revoked, causing memory leaks during long backups.
Solution: Track all created Blob URLs and revoke them on completion/cancel/error.
Results:
- Memory usage stays stable during long backups
- No more "browser out of memory" errors
- Cleanup happens automatically on completion, cancel, or error
DOM Caching Reduces Memory Pressure
By caching DOM queries instead of repeatedly creating new references, we reduce garbage collection pressure. This means fewer temporary objects created, less frequent GC pauses, and smoother scrolling during backup.
Reliability Improvements
Concurrent Backup Prevention
Problem: Users could accidentally start multiple backups simultaneously, causing conflicts and high memory usage.
Solution: Global flag blocks new backups while one is in progress.
File Download Timeout
Problem: File attachments could hang indefinitely if the server was slow to respond.
Solution: 30-second timeout using AbortController.
Chat Container Validation
Problem: Long backups could fail if Teams updated the DOM and invalidated our references.
Solution: Periodically validate the chat container still exists.
Performance Tips
For Fastest Backups
- Use Turbo Mode – Skip PDF generation entirely
- Close other tabs – Free up CPU and memory
- Use Ethernet – Faster file downloads
- Backup during off-hours – Less Teams server load
- Update browser – Latest Chrome/Edge has best performance
For Large Chats
- Enable Long Chat Mode – Ensures complete extraction
- Be patient – Large chats take time regardless of optimizations
- Don't interrupt – Let it complete to avoid redoing work
Frequently Asked Questions
Q: Why is my backup still slow?
A: Ensure you have a stable internet connection, close other tabs, and try Turbo Mode for text-only backups.
Q: Does parallel downloading affect Teams?
A: No. Downloads use your existing Teams authentication and don't impact Teams performance.
Q: Can I adjust the concurrency limit?
A: Currently it's fixed at 3 for stability. Higher limits caused issues in testing.
Q: Will these optimizations work on older computers?
A: Yes. In fact, older computers benefit more from the reduced CPU and memory usage.
Experience 3x Faster Backups
All optimizations are included in Teams Chat Backup v3.3—no configuration needed