Rust engines
Rust engines
YuktAI has two engines written in Rust and compiled to WebAssembly: grid search and number/date sorting, and the page RAG search. Since 5.3.11 they are the default. They return exactly the same results as TypeScript, only faster on big data. Time them here on your own sizes.
- Checking WebAssembly…
1. Grid: TypeScript vs Rust
Benchmark
Runs each engine 5 times and shows the middle time.
TypeScript
Rust
"use client"
import { YuktaiGrid } from "@yuktishaalaa/yuktai"
<YuktaiGrid
data={rows}
columns={columns}
rowKey="id"
engine="auto" // "ts" | "rust" | "auto" (Rust from 10,000 rows)
showSearchTime // "· 0.9 ms · Rust" next to the row count
onSearchTime={(t) => console.log(t.ms, t.engine)}
/>const grid = yuktai.renderGrid("#staff", {
data: rows, columns, rowKey: "id",
engine: "auto",
showSearchTime: true,
onSearchTime: (t) => console.log(t.query, t.ms, t.rows, t.engine)
})
await grid.whenEngineReady() // "rust" once WebAssembly is ready, otherwise "ts"2. Page RAG: TypeScript vs Rust
Benchmark
Each engine searches 20 times; the top 5 passages are compared.
import { createContextIndex } from "@yuktishaalaa/yuktai"
const index = createContextIndex({ rows, columns, rowKey: "id", includePage: false, engine: "rust" })
const hits = index.search("security engineer in chennai", 5)const index = yuktai.createContextIndex({ rows, columns, rowKey: "id", includePage: false, engine: "rust" })
const hits = index.search("security engineer in chennai", 5)How the engines work
Small and self-contained
The Rust code is no_std, compiled to WebAssembly and embedded in the YuktAI script as base64. There is no extra file to host, no bundler setting, and it works offline.
Same results, proved
Rust runs the same rules as TypeScript (Unicode-aware tokens, prefix matching, BM25 with the same idf), and parity tests check that every query returns the same rows and passages in the same order.
Safe fallback
Rust is the default since 5.3.11 (engine: "ts" keeps TypeScript only). If WebAssembly is missing or blocked, TypeScript runs instead with the same results, and grid.engine says "ts".
Content Security Policy
Sites with a CSP need 'wasm-unsafe-eval' in script-src for the Rust engines. This site's netlify.toml shows a working policy.