A high-performance statistics library built with Rust and WebAssembly, designed to be a modern, fast alternative to jStat.
- Pure Rust core (
stat-core) - No WebAssembly-specific code - Thin WASM boundary (
stat-wasm) - Minimal wasm-bindgen glue - Ergonomic JS/TS API (
js/package) - Modern, tree-shakeable API
-
Basic vector statistics:
sum- Sum of array elementsmean- Arithmetic meanvariance- Population variancesampleVariance- Sample variance (Bessel's correction)stdev- Population standard deviationsampleStdev- Sample standard deviation
-
SIMD-optimized implementations using
widecrate -
WASM bindings with memory-efficient typed array views
-
Benchmark suite comparing against jStat
- Distributions (normal, t, chi-square, etc.)
- Linear algebra operations
- Statistical tests
- SIMD builds with runtime detection
# Build and test
cargo build
cargo test
# Run benchmarks
cargo bench# Build WASM package
cd crates/stat-wasm
wasm-pack build --target bundler --out-dir pkgcd js/package
npm install
npm run buildcd js/bench
npm install
npm run benchimport { init, mean, variance, stdev } from '@addmaple/stats';
// Initialize WASM module
await init();
// Use statistics functions
const data = [1, 2, 3, 4, 5];
const m = mean(data);
const v = variance(data);
const s = stdev(data);📚 View Full Documentation - Comprehensive guides, examples, and API reference
The documentation includes:
- Getting Started Guide - Installation and quick start
- Examples - Multiple examples for each feature category
- API Reference - Auto-generated from TypeScript source
- Performance Guide - Optimization tips and benchmarks
cd docs
npm install
npm run dev.
├─ crates/
│ ├─ stat-core # Pure Rust statistics library
│ └─ stat-wasm # WASM bindings
├─ js/
│ ├─ package/ # TypeScript wrapper and NPM package
│ └─ bench/ # Performance benchmarks vs jStat
└─ tools/ # Build scripts