Compiler Optimization Flags
Build Type Configuration
ORB-SLAM3 uses CMake build types to control optimization levels (CMakeLists.txt:10-13):The default build configuration uses
-O3 optimization and -march=native for architecture-specific optimizations.Recommended Build Commands
For maximum performance, build with Release mode:Additional Optimization Flags
For advanced users, consider these additional compiler flags:Advanced GCC Optimization Flags
Advanced GCC Optimization Flags
-ffast-math may reduce numerical accuracy in some edge cases.ORB Extractor Parameters
The ORB feature extractor is a critical performance bottleneck. Tune these parameters in your YAML configuration:Feature Count
- Lower values (800-1000): Faster extraction, reduced accuracy
- Default (1200): Balanced performance
- Higher values (1500-2000): Better tracking, slower performance
For real-time operation on embedded systems, reduce to 800-1000 features.
Scale Pyramid Configuration
Scale Factor Tuning Guidelines
Scale Factor Tuning Guidelines
Scale Factor (ORBextractor.h:96):
- 1.2 (default): Fine-grained scale invariance, more levels
- 1.5: Coarser scales, fewer features, faster
- 2.0: Very coarse, fastest but less robust
- 8 (default): Good scale range
- 6: Faster, sufficient for most scenarios
- 10+: Better scale invariance, slower
nFeatures × (1 - scaleFactor^nLevels) / (1 - scaleFactor)FAST Threshold Parameters
Threading and Real-Time Performance
Parallel Threads
ORB-SLAM3 runs three main threads concurrently:- Tracking Thread: Processes incoming frames
- Local Mapping Thread: Optimizes local map
- Loop Closing Thread: Detects and corrects loop closures
Thread Priority Configuration
Thread Priority Configuration
For real-time systems, prioritize the tracking thread:
Real-Time Considerations
Camera Frame Rate Configuration
Camera Frame Rate Configuration
- 20 FPS: Standard for EuRoC dataset, good for most applications
- 30 FPS: Smoother tracking, requires faster hardware
- 60+ FPS: High-speed motion, challenging for real-time processing
Viewer Disabling
For headless operation, disable the Pangolin viewer:Time Measurement Tools
Enabling REGISTER_TIMES
ORB-SLAM3 includes built-in profiling tools (Settings.h:24):Performance Metrics Output
WithREGISTER_TIMES enabled, ORB-SLAM3 outputs:
- Terminal Output: Real-time performance statistics
- ExecTimeMean.txt: Detailed timing breakdown per component
Example ExecTimeMean.txt Output
Example ExecTimeMean.txt Output
Use these timing measurements to identify bottlenecks in your specific deployment scenario.
Hardware Recommendations
Minimum Requirements
From README.md:54:A powerful computer (e.g. i7) will ensure real-time performance and provide more stable and accurate results.
Recommended Hardware Specifications
CPU Requirements
CPU Requirements
Minimum:
- Intel Core i5 (4 cores) or equivalent
- 2.5 GHz base frequency
- Intel Core i7/i9 (6+ cores)
- 3.0+ GHz base frequency
- Support for AVX2 instructions
- AMD Ryzen 7/9 or Intel i9 (8+ cores)
- 3.5+ GHz boost frequency
- Good single-thread performance for tracking
Memory Requirements
Memory Requirements
| Configuration | Minimum RAM | Recommended RAM |
|---|---|---|
| Monocular | 2 GB | 4 GB |
| Stereo | 4 GB | 8 GB |
| RGB-D | 4 GB | 8 GB |
| Multi-Map | 8 GB | 16 GB |
GPU Acceleration
GPU Acceleration
ORB-SLAM3 does not natively use GPU acceleration. However:OpenCV GPU Modules:
- Compile OpenCV with CUDA support
- Some image processing operations will automatically use GPU
- Benefit varies (typically 10-30% speedup)
- ORB extraction can be parallelized on GPU
- Requires custom implementation using CUDA
- Can achieve 2-3× speedup for feature extraction
Platform-Specific Optimizations
Linux Performance Tuning
CPU Governor Settings
CPU Governor Settings
Embedded Systems (ARM/Jetson)
NVIDIA Jetson Optimization
NVIDIA Jetson Optimization
- Jetson Xavier NX: 15-20 FPS (stereo)
- Jetson AGX Orin: 25-30 FPS (stereo)
Performance Benchmarking
Measuring Tracking FPS
Add timing code to your application:Expected Performance Metrics
| Configuration | Target FPS | Typical Tracking Time |
|---|---|---|
| Monocular | 20-30 | 30-50 ms |
| Stereo | 15-25 | 40-65 ms |
| Stereo-Inertial | 20-30 | 33-50 ms |
| RGB-D | 20-30 | 33-50 ms |
These metrics assume an Intel i7 processor with recommended ORB parameters.
Troubleshooting Performance Issues
Slow Feature Extraction
Slow Feature Extraction
Symptoms: ORB extraction takes > 20ms per frameSolutions:
- Reduce
ORBextractor.nFeaturesto 800-1000 - Reduce
ORBextractor.nLevelsto 6 - Increase
ORBextractor.iniThFASTto 25-30 - Check image resolution (resize to 640×480 if larger)
Frame Dropping
Frame Dropping
Symptoms: System cannot process all incoming framesSolutions:
- Disable viewer for headless operation
- Reduce camera frame rate
- Increase CPU frequency/thermal limits
- Skip frames in application code if tracking is lost
High Memory Usage
High Memory Usage
Symptoms: RAM usage grows continuouslySolutions:
- Enable map point culling (enabled by default)
- Limit maximum number of keyframes
- Reduce feature count
- Implement periodic map saving and clearing
Best Practices Summary
- Build with Release mode and
-march=native - Tune ORB parameters for your hardware and environment
- Disable viewer in production deployments
- Enable REGISTER_TIMES during development to identify bottlenecks
- Use performance CPU governor on Linux systems
- Monitor tracking FPS to ensure real-time operation
- Test with your target dataset before deployment