Skip to content

πŸ“Š B-FAST Performance Analysis

Overview

B-FAST (Binary Fast Adaptive Serialization Transfer) is a binary serialization protocol optimized for bandwidth-constrained environments while maintaining excellent CPU performance.

🎯 Performance Summary

Simple Objects (10k)

  • B-FAST: 4.83ms
  • orjson: 8.19ms
  • JSON: 12.0ms
  • πŸš€ 1.7x faster than orjson!

Round-Trip Performance (Serialize + Network + Deserialize)

100 Mbps Network

  • B-FAST + LZ4: 16.1ms
  • orjson: 91.7ms
  • JSON: 114.5ms
  • πŸš€ 5.7x faster than orjson!

1 Gbps Network

  • B-FAST + LZ4: 7.2ms
  • orjson: 15.3ms
  • JSON: 29.4ms
  • πŸš€ 2.1x faster than orjson!

10 Gbps Network

  • B-FAST + LZ4: 6.3ms
  • orjson: 7.7ms
  • JSON: 20.9ms
  • πŸš€ 1.2x faster than orjson!

πŸš€ Specialized Performance

NumPy Arrays (8MB)

  • B-FAST: 3.29ms
  • orjson: 46.34ms
  • JSON: 318.21ms
  • πŸš€ 14x faster than orjson!
  • πŸš€ 96x faster than JSON!

🎯 Ideal Use Cases

βœ… B-FAST Excels When:

  1. Network bandwidth is limited (mobile, IoT) - 5.7x faster
  2. Simple objects - 1.7x faster than orjson
  3. NumPy arrays are involved (ML, data science) - 14-96x faster
  4. Storage efficiency is important - 89% compression
  5. Large datasets - Up to 5.7x faster on slow networks

❌ Consider Alternatives When:

  1. Ultra-fast networks (10+ Gbps internal) - marginal difference
  2. Ecosystem compatibility is critical - JSON is still standard
  3. Very small payloads (< 1KB) - compression overhead

πŸ“ˆ Performance Characteristics

Linear Scaling

B-FAST performance scales linearly with data size: - 100 objects: ~5.6ΞΌs per object - 1,000 objects: ~5.5ΞΌs per object
- 10,000 objects: ~4.8ΞΌs per object

Memory Efficiency

  • Zero-copy NumPy arrays
  • Cache-aligned memory operations
  • Efficient compression with LZ4

πŸ”¬ Technical Optimizations

Rust Implementation

  • Direct memory access with unsafe operations
  • Efficient type detection and serialization
  • Optimized Pydantic integration - reads directly from memory

Compression

  • Built-in LZ4 compression
  • Fast decompression for client-side
  • No external dependencies required

🌐 Network Analysis

B-FAST's advantage increases as network speed decreases:

Network Speed B-FAST Advantage
100 Mbps 5.7x faster than orjson
1 Gbps 2.1x faster than orjson
10 Gbps 1.2x faster than orjson

πŸ“Š Benchmark Methodology

Test Environment

  • Data: 10,000 complex Pydantic objects
  • Iterations: Multiple runs with warmup
  • Network: Simulated transfer times

Test Data Structure

class User(BaseModel):
    id: int
    name: str  
    email: str
    active: bool
    scores: list[float]

Measurement Approach

  • Pure serialization: CPU time only
  • Round-trip: Serialize + network transfer + deserialize
  • Network simulation: Realistic bandwidth calculations
  • Statistical analysis: Average of multiple runs

🎯 Conclusion

B-FAST achieves its design goal of being the optimal choice for bandwidth-constrained environments while maintaining competitive CPU performance. The 89% payload reduction combined with 1.7x serialization speedup makes it ideal for mobile, IoT, and data-intensive applications.

πŸ“š Next Steps