High-performance Avro encoding and decoding utilities.
This module provides optimized Avro serialization and deserialization using serde_avro_fast for best performance, with rayon parallelism for large batches.
Performance
- Encoding: Uses
serde_avro_fastfor 2-3x faster encoding thanapache_avro - Decoding: Uses
serde_avro_fast+ rayon for up to 8x faster decoding - Parallelism: Automatically enabled for batches above threshold (500 records)
These helpers split large batches over rayon’s threads, with the results of a sequential pass: records come back in order, and a batch with several bad records reports the first of them. Failures read “Could not encode object: …” and “Could not decode object: …”.
Usage
Encoding Records
Decoding Records
Constants
pub const PARALLEL_THRESHOLD: usize = 500;Threshold for switching to parallel processing. Below this count, sequential processing is faster due to thread spawning overhead. Based on benchmarks: parallel becomes beneficial around 500 records.