High-Throughput Native Acceleration for ISO 20022#
pain001-fast is an optional, high-throughput native acceleration core written in Rust with PyO3 bindings. Designed for corporate treasury backbones, high-frequency clearing hubs, and payment service providers, it offloads CPU-intensive validation loops from the Python Global Interpreter Lock (GIL) to parallel multi-core hardware.
When installed, pain001 core automatically promotes IBAN, BIC, and character set validations to native machine speed without requiring any configuration or API changes.
Performance Characteristics#
Micro-benchmarked on modern 64-bit multi-core hardware:
| Benchmark Scenario | Standard Pure Python | pain001-fast (Rust) | Speedup Factor |
|---|---|---|---|
| IBAN Checksum (Mod-97) | 1,850 ns / op | 22 ns / op | ~84× faster |
| BIC Structural Check | 1,200 ns / op | 14 ns / op | ~85× faster |
| SWIFT-X Diacritic Sanitization | 2,100 ns / op | 115 ns / op | ~18× faster |
| Batch Analysis (10,000 orders) | 3,450 ms | 165 ms | > 60,000 tx/sec |
| Heap Memory Overhead | ~12 objects / tx | 0 heap allocations | Zero Allocation |
Core Capabilities#
1. Zero-Allocation Mod-97 Engine
Implements ISO 7064 mod-97-10 check digit verification directly in CPU registers. By streaming ASCII character byte arithmetic through an inlined modular accumulator, pain001-fast completely eliminates the big integer string heap allocations that constrain standard interpreter runtimes.
2. Regex-Free Structural BIC Parsing
Validates 8 and 11 character ISO 9362 Business Identifier Codes using inlined byte checks and branchless lookup tables against the official ISO 3166-1 alpha-2 country registry.
3. NFKD Character Set Sanitizer
Fast Unicode normalization decomposes accented characters (such as é to e, ü to u) and replaces unpermitted characters with compliant ASCII delimiters in sub-microsecond time.
4. Parallel Multi-Core Batch Analyzer
Leverages Rayon work-stealing thread pools to validate thousands of transaction records across all available CPU cores simultaneously:
- Calculates per-currency control sums and counts.
- Builds SHA-256 / composite collision fingerprints to detect duplicate payments in memory.
- Returns comprehensive structured diagnostic reports with sub-50ms p99 latency.
Python API Quick Start#
# Sub-25ns IBAN validation
assert is True
# Structural BIC verification
assert is True
# High-throughput batch validation across CPU cores
=
=
assert is True
assert == 1
assert == 1250.00
Architectural Guarantee & Fallback#
pain001-fast maintains complete behavioral and cryptographic parity with standard pain001. In constrained execution environments such as Pyodide, WebAssembly, or minimalist containers where native compiled extensions are unavailable, pain001 falls back cleanly to its pure-Python routines with zero disruption.