Skip to content
angelatgithub edited this page Sep 19, 2026 · 1 revision

mojo-kernels

Clean-room Mojo kernels as drop-in accelerators for popular Python and TypeScript libraries. Same API, same results — measured speedups from 1.1× to 8,769×, with parity asserted against the reference packages by differential test suites that run on both backends. Prebuilt per-platform binaries mean no Mojo toolchain is ever required on an end user's machine, and every package ships a vendored pure-language fallback, so unsupported platforms — including Windows — get silently correct behavior.

Repository: thyn-ai/mojo-kernels · Apache-2.0, © 2026 Algenta

I want…

  • …speed → Getting Started for install patterns and the fallback contract, then the kernel catalog to find your library.
  • …to understand how this works → How It Works: the factory from mojo build --emit shared-lib to a self-contained wheel, the ABI handshake, and why the fallback exists.
  • …to contribute a kernel → Writing a Kernel: the evidence bar, the clean-room rule, the batch C-ABI shape, and the differential-test requirement.
  • …the numbers → Benchmarks: methodology, the consolidated measured table for every kernel, and the honest lowlights.
  • …a deep dive → Kernel: bm25 · Kernel: Fuse · Kernel: cclib GaussGrid

The three-part promise

  1. Parity-tested, not "approximately equal". Every kernel runs a differential suite against the real reference package — once on the native backend, once with the fallback forced — at a documented per-kernel tolerance (several are bit-identical). A correctness gate runs before every timing pass, so a benchmark can never report a fast wrong answer.
  2. Fallback everywhere. Every package vendors a pure-Python / pure-JavaScript reference implementation. Missing native library, wrong platform, ABI mismatch — the package keeps working, silently and correctly. The fallback is the product on Windows; see How It Works.
  3. Clean-room, always. Kernels implement published textbook algorithms from their descriptions, never from the reference package's source. The reference packages are test and benchmark oracles only — never runtime dependencies.

Top 10 measured speedups

Median of 5 runs on an Apple M4 Max (macOS 26.6.2 arm64, Mojo 1.1.0), 2026-09-19, correctness-gated before timing. Peak cell per package — the full range, including cells where we are not faster, is in Benchmarks.

# package accelerates peak measured speedup
1 bm25-mojo rank_bm25 8,769× (100k docs, 20-term query)
2 cclib-mojo cclib method.volume (PyQuante1 path) 7,033× (1 MO, 100³ grid)
3 pypdf-filters-mojo pypdf LZW decode 1,776× (1 MiB random stream)
4 pykalman-mojo pykalman filter 827× (T=10k, n_s=2)
5 elephant-mojo elephant spike-train dithering 342× (plain dither)
6 uproot-mojo uproot vector<string> basket walk 173× (50k entries)
7 metpy-mojo MetPy CAPE/CIN on a 25×25 grid 157× (625 columns)
8 natural-mojo natural Damerau–Levenshtein 64× (512-code-unit pairs)
9 dynesty-mojo dynesty nested sampling 52× (bootstrap=0, vectorized)
10 jsonpath-mojo jsonpath_ng 49× (100-book documents)

Honesty clause: the same suites also measured 1.1× (jmespath, best case), 0.8× dips (minisearch exact-match), and sub-1× cold starts (ta, vader). We publish those too — see the lowlights.

Status

26 packages on main — 22 Python (pip install …-mojo) and 4 TypeScript (npm install @…-mojo/core) — each with its Mojo kernel, differential suite, seeded benchmark, per-platform packaging, and vendored fallback. The catalog: Kernels. What lands next: Roadmap.


mojo-kernels is built by the Algenta team. Kernels are clean-room; reference packages are oracles, never dependencies. Questions: FAQ · Issues

mojo-kernels — clean-room Mojo kernels as drop-in accelerators

Start

Understand

Contribute

Project

Apache-2.0 · © 2026 Algenta

Clone this wiki locally