Bamboo Core (Rust)
A high-performance Vietnamese input method engine (IME) core written in Rust, inherited and optimized from the original bamboo-core in Go.
π Version 0.3.6: Pipeline & Cache Optimization
This release focuses on hot-path performance, achieving a 2Γ speedup on the DFA fast path through pipeline reorganization and memory layout optimization.
Key Enhancements:
- DFA Fast Path 2Γ Faster: Reorganized
process_keyinto three distinct paths (English β DFA fast β slow), allowing the DFA fast path to skip redundantcan_process_key_rawvalidation. - Compact Transformation Struct: Reduced
Transformationfrom 48 bytes to 28 bytes (42% smaller) by usingOption<u8>for target indices. This improves CPU cache utilization for all buffer operations. - Pre-allocated Buffers:
committed_textnow pre-allocates 256 bytes to avoid reallocation during typical usage.
Performance (vs 0.3.5 baseline):
| Metric | Before | After | Improvement |
|---|---|---|---|
| DFA fast path | ~100 ns | ~45 ns | 2.2Γ |
| DFA miss path | ~90 ns | ~43 ns | 2.1Γ |
Transformation size |
48 bytes | 28 bytes | 42% smaller |
[Transformation; 16] |
768 bytes | 448 bytes | 42% smaller |
π‘ Origin & Philosophy
This project is a high-performance Rust port of the Bamboo Vietnamese engine, originally developed by Luong Thanh Lam.
Bamboo provides a flexible Vietnamese typing solution based on rule-based transformations. This approach allows the engine to easily adapt to various typing styles (Telex, VNI, VIQR) and support modern features like free-style typing and intelligent spell checking.
The core philosophy is inspired by:
- bogo.js: Pioneering the transformation model.
- bamboo-core: The gold standard for accuracy and user experience.
- NexusKey: Modern state machine and array optimization techniques.
π¦ Installation
Add this to your Cargo.toml:
[]
= "0.3.6"
π οΈ Quick Start
use ;
π₯ Credits
- Rust Port & Optimization: Dao Trong Nguyen (@nguyen10t2)
- Original Author (Go): Lam (@lamtq)
- Technical Consultant: Mai Tan Phat (@phatMT97) - Author of VKey.
π License
This project is licensed under the MIT License. See LICENSE for details.