Decode improvements - #11
Merged
Merged
Conversation
…ng B-FAST binary data and implement tests for various data types
… parallel decompression in typescript
marcelomarkus
added a commit
that referenced
this pull request
Sep 22, 2026
* feat: recurse to B-FAST-LLM proxy add decode_packed method for decoding B-FAST binary data and implement tests for various data types * feat(release): bump python to 1.3.0, ts client to 1.2.0 and implement parallel decompression in typescript * test: fix timezone comparison log in type-preservation test * fix: update changelog to correct feature description for parallel decompression * Refactor code structure for improved readability and maintainability * style: format src/lib.rs using cargo fmt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
📋 Description
This Pull Request introduces the Rust-powered binary decoder for the B-FAST serialization protocol, natively integrated into the
bfast-pycore package via PyO3. It also adds support for parallel LZ4 chunk decompression fallback in thebfast-clientTypeScript client package and fixes critical segmentation faults related to multithreaded Rayon allocations.🔗 Related Issues
Fixes # (No open issues, requested directly by user)
🧪 Type of Change
🚀 Changes Made
1. Rust Core & Python Bindings (
bfast-py)decode_packed(bytes, *, decompress=True) -> PyObjecton theBFastclass.MAX_RECURSION_DEPTH = 128) to prevent stack overflow crashes.2. Thread-Safety & Allocator Bugfix
PyMemAllocatorglobal allocator insidesrc/allocator.rs. The custom allocator was calling Python's GIL-bound allocation functions (PyMem_Malloc) on background threads without the GIL, causing memory corruption. Reverted to Rust's native thread-safe system allocator.3. TypeScript Client (
bfast-client)client-ts/index.tsto decompress chunks in parallel using.ArrayBufferslice to avoid offset-resolution.tsconfig.jsonso they are compiled cleanly.4. Releases & Versioning
bfast-pypackage version to1.3.0(inpyproject.toml,Cargo.toml, andpython/b_fast/__init__.py).bfast-client(TypeScript client) version to1.2.0(inclient-ts/package.json).1.3.0releases.🧪 Testing
Test Results
🐍 Python Test Suite (All 33 tests passed in 0.59s)
⚡ TypeScript Integration Suite (100% type preservation and parallel LZ4 decoding validation)
📊 Performance Impact
Benchmarks (if applicable)
The Rust decoder achieves ultra-fast deserialization compared to Python decoding by parsing binary structures in native Rust memory, yielding a major performance boost for large payloads.
📊 Documentation
docs/updated (if needed)✅ Checklist
🔍 Review Notes
Please check the
decompress_packedimplementation in src/lib.rs and the allocator replacement in src/allocator.rs. Rayon multi-threaded operations now execute completely in Rust's system memory space, which eliminates Python GIL dependency issues and segfaults.📸 Screenshots (if applicable)
N/A
🤝 Additional Context
N/A