Introducing RunMat: Fast, Free, Modern MATLAB Code Runtime

8 min read Original article ↗

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, and printf-style formatting like fprintf/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.
  • New to MATLAB? Start with our primer: What is MATLAB? The Language, The Runtime, and RunMat.

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. If you want a short background explainer, see this guide.


Language compatibility at a glance

A quick view of core language semantics. Full details: here.

Feature CategoryRunMatOctave
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

BenchmarkGNU Octave avg (s)RunMat interp avg (s)RunMat JIT avg (s)Speedup vs Octave
Startup Time0.91470.00500.0053172x–183x faster
Matrix Operations0.82200.00500.0050164x faster
Mathematical Functions0.86770.00570.0053153x–163x faster
Control Flow0.87570.00570.0057155x 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

For a broader landscape view, see our comparison of RunMat vs Octave, Julia, and Python in the MATLAB alternatives guide.


How it works

  • VM 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 automatic fusion and data residency. Run your code on GPUs without any modifications across CPU, Metal (macOS), DirectX 12 (Windows), and Vulkan (Linux) via the wgpu backend. Additional backends (CUDA, ROCm, OpenCL) are planned.

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.


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.
  • Extensive builtin coverage in the runtime (canonical math like sin/cos/tan, reductions like sum/min/max, basic string/formatting via fprintf/sprintf, array creation like zeros/ones/eye, linear algebra, FFT/signal processing, statistics, and I/O), with additional functions available 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.

Editor's note (April 2026): A lot has changed since this launch post. Here is a summary of what has shipped since August 2025:

  • Plotting is no longer a work in progress. RunMat now supports 17+ GPU-accelerated plot types including surf, contour, bar, pie, quiver, stem, area, errorbar, and full 3D variants, with graphics handles, styling, and figure export. See the plotting guide for runnable examples or the plotting docs for reference.
  • Browser sandbox — A full browser-based IDE is now available at runmat.com/sandbox, running entirely client-side via WebAssembly and WebGPU. See the browser guide.
  • LSP and IDE support — A first-party language server and VS Code / Cursor extension now provide diagnostics, completions, hover, and document symbols.
  • ~330+ builtins are now documented in the function reference, covering arrays, linear algebra, FFT/signal, statistics, strings, I/O, and plotting.
  • GPU fusion now has dedicated documentation covering 7 fusion patterns: elementwise chains, reductions, matmul epilogues, covariance, power-step normalization, explained variance, and image normalization.
  • Collaboration and teams — Organizations, project roles, real-time sync, and API keys are now available through RunMat App.
  • Versioning — Automatic per-file versioning, project snapshots, and git export are built in.
  • Desktop app — A native desktop application is in active development.

The runtime is now at v0.3.2. The original content below reflects the state at launch and remains accurate for the core architecture and design philosophy.


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.

Related posts

500 Hz square wave and its FFT showing odd harmonics at 500, 1500, 2500, 3500 Hz, rendered in the RunMat browser sandbox

MATLAB FFT in RunMat: Frequency Analysis with GPU-Accelerated Plotting

Learn MATLAB FFT online with RunMat. Compute and plot FFT spectra with MATLAB-compatible syntax, including single-sided spectra, windowing, and 2D FFT in the browser.

How to use GPU in MATLAB without CUDA: Apple Silicon, NVIDIA, AMD, and Intel

How to Use GPU in MATLAB Without CUDA: Apple Silicon, NVIDIA, AMD & Intel

A practical guide to GPU acceleration in MATLAB on any hardware. How it works on NVIDIA with the Parallel Computing Toolbox, why it doesn't work on Apple Silicon, AMD, or Intel, and how to get GPU acceleration without CUDA.

RunMat plotting guide showing 2D and 3D plot examples

MATLAB Plotting in RunMat: Complete Guide to 2D, 3D & GPU-Accelerated Figures

A hands-on guide to plotting in RunMat with 20+ runnable examples covering line plots, scatter, bar charts, 3D surfaces, contour maps, subplots, animations, and GPU-accelerated rendering. All examples run in the browser.

Enjoyed this post? Join the newsletter

Monthly updates on RunMat, Rust internals, and performance tips.

Try RunMat for free

Write code or describe what you want to compute. The sandbox is free, no account required.