v6.0.0 - Native Rust Extension for 29x Faster Performance
json2xml v6.0.0 🚀
Major Release: Native Rust Extension for 29x Faster Performance
This release introduces an optional native Rust extension built with PyO3 that provides approximately 29x faster JSON to XML conversion compared to pure Python.
✨ Highlights
- Optional Rust acceleration - Install
json2xml-rsfor blazing fast performance - Zero breaking changes - Pure Python version works exactly as before
- Automatic backend selection - Use
dicttoxml_fastmodule for auto-detection - Cross-platform wheels - Pre-built for Linux, macOS (Intel + Apple Silicon), Windows
📊 Performance Benchmarks
| JSON Size | Pure Python | With Rust | Speedup |
|---|---|---|---|
| Small (47 bytes) | 6.85 µs | 0.21 µs | 33x |
| Medium (3.2KB) | 160 µs | 5.6 µs | 28x |
| Large (32KB) | 1.59 ms | 53 µs | 30x |
| Very Large (323KB) | 16.4 ms | 569 µs | 29x |
📦 Installation
# Pure Python (always works)
pip install json2xml
# With Rust acceleration (optional, recommended)
pip install json2xml json2xml-rs🔧 Usage
# Option 1: Auto-selecting wrapper (recommended)
from json2xml.dicttoxml_fast import dicttoxml
xml = dicttoxml({"name": "John", "age": 30})
# Option 2: Direct Rust import (fastest, requires json2xml-rs)
from json2xml_rs import dicttoxml
xml = dicttoxml({"name": "John", "age": 30})
# Option 3: Pure Python (always available)
from json2xml.dicttoxml import dicttoxml
xml = dicttoxml({"name": "John", "age": 30})📁 New Files
rust/- PyO3 Rust extension source codejson2xml/dicttoxml_fast.py- Auto-selecting wrapper moduletests/test_rust_dicttoxml.py- 84 comprehensive testsbenchmark_rust.py- Performance comparison script.github/workflows/build-rust-wheels.yml- CI for building wheels.github/workflows/rust-ci.yml- CI for Rust code quality
⚠️ Rust Extension Limitations
The Rust implementation does not yet support:
idsparameteritem_funcparameterxml_namespacesparameterxpath_formatparameter@attrs,@val,@flatspecial dict keys
For these features, use the pure Python implementation or dicttoxml_fast (which auto-falls back).
🔗 Related Projects
- Go version: github.com/vinitkumar/json2xml-go
- Zig version: github.com/nicholasgriffintn/json2xml-zig
📝 Full Changelog
See HISTORY.rst for complete changelog.
Thank you to all contributors! 🙏