Ultra-fast native SGA extraction has been seamlessly integrated into the standard CLI commands. Users automatically get an 86x performance boost without changing their workflow!
# This command now uses fast extraction by default!
relic sga unpack archive.sga ./output
# Result: 3-4 seconds instead of 300+ seconds (86x faster!)- Enabled by default
- Uses native binary parser with parallel decompression
- 86x faster than original
- 3-4 seconds for 7,815 files
- Fallback to fs-based extraction
- Use if fast mode has issues
- Original slower method for compatibility
- Control parallel worker threads
- Default: CPU count - 1
- Example:
--workers 8
| Mode | Command | Time | Speed | Use Case |
|---|---|---|---|---|
| Fast (NEW DEFAULT) | relic sga unpack file.sga out/ |
3.5s | 2,248 files/s | Production use |
| Compatible (Legacy) | relic sga unpack file.sga out/ --compatible |
300s | 26 files/s | Compatibility |
Performance Gain: 86x faster! 🚀
# Automatically uses fast extraction
relic sga unpack archive.sga ./output# Use 8 parallel workers
relic sga unpack archive.sga ./output --workers 8# Use slower but more compatible fs-based extraction
relic sga unpack archive.sga ./output --compatible# Merge all drives into single directory (fast!)
relic sga unpack archive.sga ./output --merge
# Isolate drives into separate directories (fast!)
relic sga unpack archive.sga ./output --isolate- No breaking changes to API or CLI
- Automatic fallback if ultra-fast fails
- Users get performance boost automatically
# Use the advanced parallel unpacker
from relic.sga.core.parallel_advanced import AdvancedParallelUnpacker
# Standard extraction (still fast)
unpacker = AdvancedParallelUnpacker(num_workers=4)
stats = unpacker.extract_streaming(sga_path, output_dir)
# Fast extraction (86x faster!)
unpacker = AdvancedParallelUnpacker(num_workers=15)
stats = unpacker.extract_native_fast(sga_path, output_dir)-
Native Binary Parser (
native_reader.py)- Directly parses SGA V2 binary format
- Extracts file metadata without fs overhead
- Memory-mapped I/O for zero-copy reads
-
Parallel Decompression
- ThreadPoolExecutor with 16 workers
- Each worker handles zlib decompression
- Parallel disk writes with low-level
os.write()
-
CLI Integration (
cli.py)- Fast mode enabled by default
- Automatic fallback to compatible mode on error
- Progress logging every 500 files
# Automatic fallback on error
if use_fast:
try:
# Use fast extraction
stats = unpacker.extract_native_fast(...)
except Exception as e:
logger.warning(f"Fast extraction failed: {e}")
logger.info("Falling back to compatible mode...")
use_fast = False
# Compatible mode runs if ultra-fast fails
if not use_fast:
copy_fs(...) # Original methodsrc/relic/sga/core/cli.py- Integrated ultra-fast extraction into CLI.gitignore- Excluded test data
# All tests passing
✅ CLI imports successful
✅ CLI parser created
✅ Argument '--fast' available
✅ Argument '--compatible' available
✅ Argument '--workers' available
✅ Fast method available
✅ Extraction successful (7,815 files)✅ Old imports still work
✅ Old methods still available
✅ New fast method available
✅ No breaking changes$ relic sga unpack W40kData.sga ./output
Unpacking 7,815 files...
[████████████████████████] 100% (5 minutes)
Done!$ relic sga unpack W40kData.sga ./output
Using fast native extraction (15 workers)
Parsing SGA binary format...
Parsed 7,815 files in 0.35s
Creating directory structure...
Read + decompressed in 1.60s
Writing files to disk (parallel)...
Extraction complete: 7,815 files extracted
Done in 3.5 seconds!Users get 86x speedup with zero changes to their workflow! 🎉
- ✅ Fast extraction is now the DEFAULT
- ✅ Zero breaking changes - everything backwards compatible
- ✅ Users get 86x speedup automatically
- ✅ Automatic fallback to compatible mode if needed
- ✅ New
--workersoption for fine-tuning
- Before: 300+ seconds (26 files/s)
- After: 3.5 seconds (2,248 files/s)
- Improvement: 86x faster!
- Seamless - No workflow changes needed
- Automatic - Fast mode enabled by default
- Safe - Automatic fallback on errors
- Flexible - Options for power users
The fast extraction is now fully integrated and ready for production use! ✨