FACT (Fast Augmented Context Tools)
A high-performance cognitive template processing engine written in Rust with WebAssembly support.
Installation
As a Rust Crate
As a CLI Tool
For WebAssembly
Usage
Rust Library
use ;
CLI Usage
# Process a query
# Show cache statistics
# Clear cache
# Run benchmarks
# Show performance statistics
WebAssembly Usage
import init from './pkg/fact.js';
;
Features
- High Performance: Optimized Rust implementation with SIMD support
- WebAssembly Support: Run in browsers and Node.js
- Intelligent Caching: LRU cache with automatic eviction
- CLI Tool: Command-line interface for easy usage
- Cognitive Templates: Pre-built templates for common patterns
- Cross-Platform: Works on Linux, macOS, and Windows
Performance
FACT achieves exceptional performance through:
- Memory-efficient data structures using
rustc-hash
andsmallvec
- SIMD optimizations for vectorized operations (WASM SIMD support)
- Zero-copy operations where possible
- Compile-time optimizations with LTO and aggressive inlining
- Hot key optimization with intelligent caching strategies
Benchmark Results
- WASM bundle size: 248KB (optimized with wasm-opt)
- Cache operations: Sub-microsecond access for hot keys
- Query processing: Pattern recognition with cognitive templates
- Memory usage: Efficient LRU cache with TTL support
- Build time: <10 seconds for optimized WASM build
Optimization Features
- Batch processing for improved throughput
- Async operations with non-blocking execution
- Memory pooling to reduce allocations
- Performance metrics collection and analysis
Building from Source
Prerequisites
- Rust 1.70+ with
wasm32-unknown-unknown
target - wasm-pack:
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
Quick Build
# Clone the repository
# Build WASM for web (recommended)
# Or manual build
Library Build
# Build Rust library
# Build with CLI support
# Run tests
Multi-Target WASM Build
# Web target (default)
# Node.js target
# Bundler target
Testing
# Run unit tests
# Run benchmarks
# Run WASM tests
Contributing
Contributions are welcome! Please read our Contributing Guide for details.
License
MIT License - see LICENSE for details.