Expand description
fast-yaml-parallel: Multi-threaded YAML processing.
Provides parallel processing for:
- Multi-document YAML streams (document-level parallelism)
- Multiple YAML files (file-level parallelism)
§Performance
Expected speedup on multi-document files:
- 4 cores: 3-3.5x faster
- 8 cores: 6-6.5x faster
- 16 cores: 10-12x faster
§When to Use
Use parallel processing when:
- Processing multi-document YAML streams (logs, configs, data dumps)
- Batch processing multiple YAML files
- Input size > 1MB with multiple documents
- Running on multi-core hardware (4+ cores recommended)
Use sequential processing when:
- Single document files
- Small files (<100KB)
- Memory constrained environments
§Examples
Document-level parallelism:
use fast_yaml_parallel::parse_parallel;
let yaml = "---\nfoo: 1\n---\nbar: 2\n---\nbaz: 3";
let docs = parse_parallel(yaml)?;
assert_eq!(docs.len(), 3);File-level parallelism:
use fast_yaml_parallel::{FileProcessor, Config};
use std::path::PathBuf;
let processor = FileProcessor::new();
let paths = vec![PathBuf::from("file1.yaml"), PathBuf::from("file2.yaml")];
let result = processor.parse_files(&paths);
println!("Processed {} files, {} successful, {} failed",
result.total, result.success, result.failed);Custom configuration:
use fast_yaml_parallel::{parse_parallel_with_config, Config};
let config = Config::new()
.with_workers(Some(8))
.with_sequential_threshold(2048);
let yaml = "---\nfoo: 1\n---\nbar: 2";
let docs = parse_parallel_with_config(yaml, &config)?;Structs§
- Batch
Result - Aggregated results from batch processing.
- Config
- Configuration for parallel processing behavior.
- File
Processor - Parallel file processor for batch YAML operations.
- File
Result - Result for a single file with path context.
- Smart
Reader - Smart file reader that chooses optimal reading strategy based on file size.
Enums§
- Error
- Unified error type for all parallel operations.
- File
Content - File content holder that abstracts over in-memory strings and memory-mapped files.
- File
Outcome - Outcome of processing a single file.
- Value
- A YAML node is stored as this
Yamlenumeration, which provides an easy way to access your YAML document.
Functions§
- parse_
parallel - Parse multi-document YAML stream in parallel.
- parse_
parallel_ with_ config - Parse multi-document YAML with custom configuration.
- process_
files - Process multiple YAML files in parallel.
Type Aliases§
- Result
- Result type for parallel operations.