TL;DR
- RunMat is a modern, open-source runtime that executes MATLAB code fast.
- We implement the full language grammar and the core semantics (arrays, indexing, control flow, functions, cells/structs, OOP).
- The core stays small and fast; everything else grows via a package system (native Rust or source MATLAB).
- Core built-ins are canonical (e.g.,
sin
,cos
,sum
, andprintf
-style formatting likefprintf
/sprintf
) and match the expected, documented behavior. When semantics are domain-specific or ambiguous, they live in packages. - Built in Rust, with tiered execution (interpreter first, JIT for hot code) and a generational GC tuned for numerics.
- Benchmarks show 150x–180x speedups vs GNU Octave on representative workloads; see Performance below.
Why another runtime?
If you've written MATLAB code, you know the trade-offs:
- MATLAB is powerful but proprietary and heavy to start; deployment is license-bound.
- GNU Octave is free and compatible with lots of code, but startup and hot-path performance can be limiting.
- Moving to a new language means rewriting and - perhaps most importantly - retraining.
RunMat aims for a fourth path: keep the MATLAB language you know, but put it on a modern engine with a smaller core, clean semantics, and open extensibility.
Language compatibility at a glance
A quick view of core language semantics. Full details: here.
Feature Category | RunMat | Octave |
---|---|---|
Grammar & parser (full MATLAB surface) | ✅ | ✅ |
Arrays & indexing (end , colon, logical masks, N-D slicing) | ✅ | ✅ |
Multiple returns, varargin /varargout , nargin /nargout | ✅ | ✅ |
OOP classdef (props/methods), operator overloading | ✅ | ❌ |
Events/handles (addlistener , notify , isvalid , delete ) | ✅ | ❌ |
Imports precedence & static access (Class.* ) | ✅ | ❌ |
Metaclass operator ?Class | ✅ | ❌ |
String arrays (double-quoted) | ✅ | ❌ |
Standardized MException identifiers | ✅ | ❌ |
If something you rely on is not in the core, packages are the intended extension point.
What RunMat is (and is not)
What it is:
- A new runtime that accepts MATLAB syntax and executes the core semantics quickly.
- A slim, production-oriented engine written in Rust with a stable Value/Type/ABI.
- A system that grows through packages: built-ins implemented in Rust or MATLAB.
- A predictable core of canonical built-ins (math, array ops, formatting/IO) with stable behavior; broader or niche functionality ships as packages.
What it is not:
- Not a re-packaging of MATLAB. We don't ship MATLAB code, assets, or toolboxes.
- Every historical builtin. We prioritize a small, consistent core and let packages provide breadth.
- Not affiliated with MathWorks; not a drop-in replacement for every workflow.
Legal clarity: RunMat is an independent project that implements a compatible language runtime. “MATLAB” is a MathWorks trademark; we use it nominatively to describe the language whose grammar and semantics our compiler/interpreter accepts. We are not endorsed by or associated with MathWorks.
Performance
On an Apple M2 Max (32GB), our micro-benchmarks (matrix ops, math functions, control-flow loops) show large speedups over GNU Octave on the same machine:
Summary results
Benchmark | GNU Octave avg (s) | RunMat interp avg (s) | RunMat JIT avg (s) | Speedup vs Octave |
---|---|---|---|---|
Startup Time | 0.9147 | 0.0050 | 0.0053 | 172x–183x faster |
Matrix Operations | 0.8220 | 0.0050 | 0.0050 | 164x faster |
Mathematical Functions | 0.8677 | 0.0057 | 0.0053 | 153x–163x faster |
Control Flow | 0.8757 | 0.0057 | 0.0057 | 155x faster |
- We don't compare to MATLAB here due to licensing constraints (we decline to install Matlab and agree with their license terms). Our focus is the design: a slim core and a modern engine.
- Benchmarks are in the repo under
/benchmarks
with a script to reproduce. Numbers vary by hardware, BLAS, and build settings; please measure on your workload. To reproduce locally:
cd benchmarks
./run_benchmarks.sh
cat results/benchmark_YYYYMMDD_HHMMSS.yaml
How it works
- Ignition interpreter: immediate execution, great for REPL and scripts.
- Turbine JIT: hot functions get compiled to optimized machine code (Cranelift backend).
- Slim builtins: a curated set in core; everything else via packages. Docs are generated from runtime metadata.
- Great developer experience: built in Jupyter kernel, flow-sensitive inference for great autocomplete and type hints, and more.
- Portable: single binary, no dependencies, runs on Linux/macOS/Windows and embedded devices.
- GPU-optimized: built in, configurable, swappable GPU planner with reverse-mode autograd support by default. Run your code on GPUs without any modifications across CPU, CUDA, ROCm, Metal, Vulkan, OpenCL, and WGPU platforms (coming soon).
For a deeper dive, see How It Works and the Architecture & Internals section.
Packages: extending the runtime
Two ways to add capabilities:
- Native (Rust) packages: implement built-ins with
#[runtime_builtin]
, get strong typing and speed, and ship as a dynamic library. - Source (MATLAB) packages: ship
.m
files; RunMat interprets or compiles them.
Documentation is generated from runtime metadata, so everything you add shows up in the reference automatically. See the Package Manager doc for the full design and examples.
What you can run today
- Core language: arrays, slicing (
end
, colon, logical masks), functions and multiple returns, cells/structs, OOP (classdef
with properties/methods),try/catch
,global
,persistent
, function handles, command-form. - A curated builtin set in the runtime (canonical math like
sin/cos/tan
, reductions likesum/min/max
, basic string/formatting viafprintf/sprintf
, array creation likezeros/ones/eye
), with more coming through packages.
If your code relies on many niche built-ins, the recommended path is to move those pieces into packages. The docs call out differences and migration notes where they exist.
A note about about plotting: RunMat's plot package is a work in progress. It's near-complete, but not yet ready for production use. We're working on it, and will have a complete plotting system in the next few releases.
MATLAB, Octave, RunMat — a quick contrast
- MATLAB: proprietary, massive standard library, heavy startup, license-gated deployment. Feature-rich; closed source.
- GNU Octave: free, community-driven project with partial compatibility with MATLAB scripts. It carries a broad builtin surface and a classic interpreter architecture, but startup times and hot-loop performance can be poor. Octave is a full application; its design optimizes for breadth and compatibility.
- RunMat: open-source, modern engine with full language grammar and core semantics. We deliberately keep the core small and fast (canonical built-ins only) and move breadth into packages. This lets us optimize the engine aggressively for performance and predictability while still enabling a large library surface via the package system.
Try it & get involved
- Read the docs: Getting Started, Design Philosophy, and How It Works.
- Browse the builtin reference; it's generated from the runtime.
- Star the repo and open issues: https://github.com/runmat-org/runmat
- Interested in contributing? Packages are the best place to start (Rust or MATLAB source).
RunMat is not affiliated with MathWorks, Inc. “MATLAB” is a registered trademark of MathWorks, Inc. We reference it nominatively to describe the language whose grammar and semantics our independent runtime accepts.
RunMat is a free, open source community project developed by Dystr.
Enjoyed this post? Join the newsletter
Monthly updates on RunMat, Rust internals, and performance tips.