Ekuma is a JavaScript engine written in pure Go. Its bytecode interpreter runs without a JIT. It implements nearly all of ES2026. The Go API is unstable. See Status.
package main
import (
"context"
"fmt"
"log"
"github.com/hajimehoshi/ekuma"
)
func main() {
var vm ekuma.VM
script, err := vm.ParseScript("hello.js", `"Hello, " + ["wor", "ld"].join("")`)
if err != nil {
log.Fatalf("parse: %v", err)
}
result, err := script.Evaluate(context.Background())
if err != nil {
log.Fatalf("evaluate: %v", err)
}
fmt.Println(result.String()) // Hello, world
}The zero value of ekuma.VM is ready to use. A VM must not be copied after first use.
| Engine | Latest release | Implementation | Execution strategy | Pure Go | Host platforms | ECMAScript | Modules | Intl |
Temporal |
|---|---|---|---|---|---|---|---|---|---|
| Ekuma | v0.2.0 (2026-11-28) | Written in Go | Bytecode interpreter | ✅ | Go targets | ES2026 | ✅ | ✅ | ✅ |
| goja | None | Written in Go | Bytecode interpreter | ✅ | Go targets | ES5.1, and much of ES2015 and later | ❌ | ❌ | ❌ |
| Sobek | None | Written in Go | Bytecode interpreter | ✅ | Go targets | ES5.1, and much of ES2015 and later | ❌ | ❌ | |
| moejs | v0.1.1 (2026-11-15) | Written in Go | Bytecode interpreter | ✅ | Go targets | Much of modern ECMAScript | ✅ | ❌ | |
| otto | v0.5.1 (2024-11-05) | Written in Go | AST interpreter | ✅ | Go targets | ES5 | ❌ | ❌ | ❌ |
| modernc.org/jit/js | v0.5.0 (2026-11-22) | QuickJS, translated from C to Go | Bytecode interpreter with a JIT | ✅ | linux/amd64 |
ES2023 | ✅ | DateTimeFormat and NumberFormat in en-US |
❌ |
| modernc.org/quickjs | v0.27.0 (2026-10-24) | QuickJS, translated from C to Go | Bytecode interpreter | ✅ | macOS, FreeBSD, Windows (amd64, arm64)Linux ( 386, amd64, arm, arm64, loong64, ppc64le, riscv64, s390x) |
ES2023 | ✅ | DateTimeFormat and NumberFormat in en-US |
❌ |
| BeastJS | v0.33.3 (2026-11-27) | QuickJS, compiled to Go assembly | Bytecode interpreter | ✅ | Linux, macOS, Windows (amd64, arm64) |
ES2023 | ✅ | ✅ Opt-in | ✅ Opt-in |
| QJS | v0.0.6 (2025-10-28) | QuickJS-ng, compiled to WebAssembly and run by wazero | Bytecode interpreter, with wazero AOT where available | ✅ | wazero targets | ES2023 | ✅ | ❌ | ❌ |
| v8go | v0.44.0 (2026-11-12) | Bindings to V8 | JIT compiler, or bytecode interpreter with --jitless |
❌ | Android, Linux, macOS (amd64, arm64)Windows ( amd64) |
ES2025 | ❌ | ✅ | ❌ |
“Go targets” indicates that the core engine has no explicit OS or architecture allowlist.
Ekuma's CI covers Linux, macOS, Windows, 386 on Linux and Windows,
and browser WebAssembly (js/wasm).
Ekuma uses a register-based interpreter, hidden classes, inline property caches, and dense array storage. JavaScript calls reuse interpreter stack space, including proper tail calls. On 64-bit platforms, a value occupies two words and can hold a number, a signed 64-bit BigInt, or a short string inline. Strings use WTF-8, preserving UTF-16 semantics and allowing well-formed strings to cross the Go boundary without transcoding.
Each value is the geometric mean of the benchmark times relative to Ekuma in one round of the suite. Lower is faster.
V8 benchmark QuickJS
suite v7 microbench Version
Ekuma 1.00 1.00 v0.2.0-alpha.0.20261127145346-5a36a064fec5
goja 8.30 6.78 v0.0.0-20261118204651-8dfece3d1e1d
Sobek 8.38 6.82 v0.0.0-20261119094010-6eceb967bb5b
moejs 1.07 1.41 v0.1.1
otto 43.4 (9/10) n/a v0.5.1
modernc.org/quickjs 5.69 4.46 v0.27.0
BeastJS 1.00 0.800 v0.33.3
QJS 7.70 (6/10) 6.94 (69/74) v0.0.6
QuickJS (C) 1.76 1.20 v0.0.0-20260604125329-3d5e064e9dd6
v8go --jitless 0.970 0.810 v0.44.0
v8go 0.0489 0.152 v0.44.0
Measured on 2026-11-28: Apple M3 Pro, macOS 27.2, go1.27.4.
(k/n) means that the engine and Ekuma both completed k of n benchmarks. The mean covers
those paired results. See the benchmark method,
individual results, and Ekuma CPU profile.
The API follows syscall/js for working with values and
functions. JavaScript exceptions return to Go as errors. Script evaluation, function calls, and
property operations take a context.Context for cancellation. The package documentation
describes cancellation, host panics, and pending jobs.
A parsed Script can be evaluated repeatedly. A second evaluation in the same realm throws
a SyntaxError if the script declares a top-level let, const, or class. To share one parse
across VMs, use ParseUnboundScript and bind the result in each VM with VM.BindScript.
Use VM.ParseModule or VM.ParseJSONModule to parse a module. For host-provided values, use
VM.NewSyntheticModule with a map from export names to values or
VM.NewDefaultExportSyntheticModule with a single default export.
The host supplies a synchronous loader through VM.SetModuleLoader, including for import().
Module.Evaluate loads, links, and evaluates the module and returns a promise.
To share one JavaScript module parse across VMs, use ParseUnboundModule and bind the result
in each VM with VM.BindModule.
VM.NewRealm creates a global object with its own built-ins. Realms in a VM share values,
jobs, and settings. Use separate VMs for independent JavaScript environments.
VM.NewPromise returns a promise and a resolver for completing it from Go. Pending promise
jobs run before the outermost Go call that executes JavaScript returns. VM.SetUnhandledRejection
receives rejections still unhandled after those jobs run. Promise continuations, including
await, preserve the host value set by VM.WithContinuationData when they were registered.
Date, Temporal, and Intl.DateTimeFormat use the local time zone by default. Override it
with VM.SetTimeZone, the clock with VM.SetClock, and the source of Math.random with
VM.SetRandomSource.
Import the optional intl package to enable Intl, locale-aware string and formatting
methods, and additional Temporal calendars in ev
8000
ery VM.
import _ "github.com/hajimehoshi/ekuma/intl"With Go 1.27.4 and default build flags, the import increases the hello-world binary
from 9.1 to 18.0 MiB on macOS arm64 and from 12.0 to 21.2 MiB on js/wasm.
VM.SetLocale overrides the host default locale.
See the intl package documentation
for host locale selection and License for distribution notices.
VMs on different goroutines share the memory of a SharedArrayBuffer as agents do:
Value.SharedDataBlock returns the memory, which VM.ValueOf turns into a new
SharedArrayBuffer of another VM.
Atomics.wait throws unless VM.SetCanBlock lets the VM block. When another VM notifies
a waiter of Atomics.waitAsync, its promise is settled by the
jobs that the waiting VM runs at the end of its current or next outermost call from Go.
VM.AwaitJobs runs pending jobs. If none are ready, it waits for an asynchronous waiter to be
notified or time out. With no pending jobs or waiters, it returns immediately.
Use a context with a deadline to cancel script execution and the promise jobs it runs.
Property operations such as Value.Get and Value.Set can run JavaScript through getters,
setters, or proxies. Give these operations a deadline too when working with values from
unreliable scripts. Calls made inside a host callback also inherit the outer call's context.
Each VM runs in the host process. For untrusted scripts, run Ekuma in a separate process with operating-system resource limits. See Missing for the current gaps in per-VM resource controls.
53,791 of the 53,795 tests of test262 pass (99.99%). The other
4 fail for known reasons, which test262-failures.txt lists.
Ekuma checks its pure Go implementation of Intl (ECMA-402) against ICU’s own tests for
collation, segmentation, and locale-aware formatting. The suite also checks Unicode normalization
and Temporal calendars. In 122 of 131 subtests, Ekuma matched the pinned ICU 78.3 and 79.1
fixtures on every case it ran. The other nine recorded 302 expected differences, including 281
where only the spacing in a formatted date range differed. The run had no unexpected failures.
See the ICU coverage inventory.
- Nearly all of the syntax and standard library up to ES2026 and Annex B, with
RegExpon its own backtracking engine Temporal, explicit resource management,import defer, and the newerError,Iterator,PromiseandArrayBufferadditionsShadowRealm, which is a proposal and not yet standard- Decorators, auto-accessors (
accessor) and decorator metadata (Symbol.metadata), which are proposals and not yet standard
Datetruncates historical UTC offsets to whole minutes.Temporal.ZonedDateTimeuses the full offset for a named time zone.- Ekuma's generated Unicode tables follow the Go release in
go.mod(Unicode 17.0.0 for Go 1.27). The parser uses the build toolchain's Unicode tables for JavaScript identifiers and may reject letters added in later Unicode versions. - Native builds load named time zones from system zoneinfo and Go's
time.LoadLocationsources. WithGOOS=js, the host'sIntl.DateTimeFormatmust also recognize the zone. LocalDateoperations use the JavaScript host'sDateby default. - Without Intl,
Temporalsupports only theiso8601calendar, thetoLocale*Stringmethods ofDateuse a fixed English format and those of numbers ignore the locale,localeComparecompares normalized code units, and case conversion ignores the locale. Intl.Collatorfollows the CLDR root collation, in which Han characters sort by code point, and the tailorings of CLDR; ICU sorts Han by radical and stroke in the rootIntl.Segmenteruses dictionary word boundaries for Chinese, Japanese, Thai, Khmer and Burmese text in every locale. Greek locales also tailor sentence breaks at question marksIntl.DisplayNamesuses a regular CLDR variant's canonical subtag when the display locale has no translation. If another subtag has no display name, the result is the canonical language code, orundefinedwithfallback: "none"Intl.DurationFormatseparates the fields of thedigitalstyle as CLDR's duration patterns do, such as1.02.03in Serbian, where ICU uses the time separatorIntl.DateTimeFormatuses the names that CLDR's root locale gives a metazone through another one, such asGreenwich Mean Timefor London in winter, where ICU uses the offset- Best-fit locale matching keeps the lookup match of a request whose script is too far from
every available locale, such as
haforha-Arab, where ICU selects the default locale - A BigInt has at most 2^30 bits, as in V8: an operation or a conversion whose result would be
larger throws a RangeError, and a larger literal is a SyntaxError.
ValueOfpanics for a larger*big.Int, and aFuncthat returns one throws a RangeError - Source phase imports and
%AbstractModuleSource%exist, but importing the source of any module throws a SyntaxError, since no host API gives a module a module source Function.prototype[Symbol.metadata]isnull, as the spec text of the decorator metadata proposal defines it, so a class without decorators inheritsnullunless its superclass has metadata- The
callerandargumentsproperties of sloppy functions, a legacy extension that the specification leaves to implementations, are accessors of each function. Browsers instead change the accessors ofFunction.prototype, which the specification defines to throw. As in SpiderMonkey,callerisnullfor a call from strict code, a generator, an async function or a built-in function. A proper tail call from strict code leaves no frame of the strict function, so the function that it calls sees the caller of the strict function instead - A
WeakMaporWeakSetentry is stored with its key, since Go's garbage collector has no ephemerons. A value that refers back to itsWeakMaptherefore keeps the map alive for as long as the key is alive - When a
MaporSetis compacted, an unfinished iterator keeps the positions of deleted entries until its next step so it can resume in insertion order
Host API for these, some of which the engine has and only the tests use:
- Providing a module source object for
import sourceandimport.source() - Property descriptors, and listing the keys of an object
- Limits on stack depth or memory, and statistics of the memory that a VM uses
go test ./...Use go test -short ./... to run the local regression tests and skip
external suites. Add -tags=ekumavalidate to check bytecode generation and execution.
go test . runs the external suites when their checkouts are available. Set the environment
variables below or place the checkouts at the listed paths under the user cache directory.
The CI setup checks out Test262 in full, lists the V8 paths,
and selects ICU files from the upstream path inventory.
| Suite | Environment variable | Default cache path | CI revision | Expectations |
|---|---|---|---|---|
| ICU 78.3 (Unicode 17, CLDR 48.2 collation) | EKUMA_ICU |
ekuma/icu |
Revision | Expected failures |
| ICU 79.1 (CLDR 49 locale and formatting data) | EKUMA_ICU_CLDR |
ekuma/icu-cldr |
Revision | Expected failures |
| Test262 | EKUMA_TEST262 |
ekuma/test262 |
Revision | Expected failures |
| V8 Intl, mjsunit, Mozilla, and WebKit | EKUMA_V8 |
ekuma/v8 |
Revision | Test expectations |
See the ICU fixture inventory for coverage and focused test commands.
When a fixture and a published specification or data release disagree, record what the fixture expects, which revision Ekuma follows, and what change would warrant revisiting the decision. Put the note beside the expected failure, or beside the local regression test when the fixture passes.
For V8's Mozilla suite, fetch the data revision pinned by V8 from the Ekuma repository root:
bash internal/jstest/checkout-mozilla.sh "$EKUMA_V8"With both V8 and Test262 checked out, TestV8Test262 also runs V8's local Test262 cases.
Use -test262.dir or -v8.dir to select a checkout-relative directory, or the corresponding
filter flag to match part of a test path.
go test -count=1 -v -run '^TestTest262$' . -test262.dir test/intl402/Collator
go test -count=1 -v -run '^TestV8$' . -v8.dir test/intl/collatorEkuma's code is licensed under 0BSD. The data tables Ekuma generates from Unicode, CLDR, and ICU releases are licensed under the Unicode License v3. The historical Chinese and Korean calendar tables are licensed under the MIT License.
Every build includes Unicode character and emoji data, so all distributions must include the Unicode copyright and permission notice.
- Windows builds must also include the CLDR time zone mapping notice,
even when built without
intl. - Builds that import
github.com/hajimehoshi/ekuma/intlmust also include the following notices.