[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-115368":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":13,"openIssues":14,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":15,"stars7d":16,"stars30d":16,"stars90d":15,"forks30d":15,"starsTrendScore":13,"compositeScore":17,"rankGlobal":10,"rankLanguage":10,"license":18,"archived":19,"fork":19,"defaultBranch":20,"hasWiki":19,"hasPages":19,"topics":21,"createdAt":10,"pushedAt":22,"updatedAt":23,"readmeContent":24,"aiSummary":25,"trendingCount":15,"starSnapshotCount":15,"syncStatus":16,"lastSyncTime":26,"discoverSource":27},115368,"ekuma","hajimehoshi\u002Fekuma","hajimehoshi","A JavaScript engine in pure Go","",null,"Go",66,1,3,0,2,42.1,"BSD Zero Clause License",false,"main",[],"2026-11-23 19:33:54","2026-11-22 06:18:15","# Ekuma\n\nEkuma is a JavaScript engine written in pure Go and is almost `unsafe`-free.\nIt uses `unsafe` only to access OS APIs.\nIt is designed for fast execution without a JIT compiler.\n\nThe project is at an early stage and its API is unstable, though nearly all of the syntax and\nstandard library up to ES2026 is implemented. See [Status](#status).\n\n```go\nvar vm ekuma.VM\ns, err := vm.ParseScript(\"hello.js\", `\"Hello, \" + [\"wor\", \"ld\"].join(\"\")`)\nif err != nil {\n\t\u002F\u002F A *ekuma.SyntaxError.\n}\nv, err := s.Evaluate(ctx)\nif err != nil {\n\t\u002F\u002F A *ekuma.ScriptError when the script throws.\n}\nfmt.Println(v.String()) \u002F\u002F Hello, world\n```\n\nThe zero value of `ekuma.VM` is ready to use. A `VM` must not be copied after first use.\n\n## Differences from other engines for Go\n\n| | Ekuma | [goja](https:\u002F\u002Fgithub.com\u002Fdop251\u002Fgoja) | [Sobek](https:\u002F\u002Fgithub.com\u002Fgrafana\u002Fsobek) | [otto](https:\u002F\u002Fgithub.com\u002Frobertkrimen\u002Fotto) | [modernc.org\u002Fquickjs](https:\u002F\u002Fpkg.go.dev\u002Fmodernc.org\u002Fquickjs) | [QJS](https:\u002F\u002Fgithub.com\u002Ffastschema\u002Fqjs) | [v8go](https:\u002F\u002Fgithub.com\u002Ftommie\u002Fv8go) |\n|---|---|---|---|---|---|---|---|\n| Latest release | None | None | None | v0.5.1 (2024-11-05) | v0.27.0 (2026-10-24) | v0.0.6 (2025-10-28) | v0.44.0 (2026-11-12) |\n| Implementation | Written in Go | Written in Go | Written in Go | Written in Go | QuickJS, translated from C to Go | QuickJS-ng, compiled to WebAssembly and run by wazero | Bindings to V8 |\n| Execution strategy | Bytecode interpreter | Bytecode interpreter | Bytecode interpreter | AST interpreter | Bytecode interpreter | Bytecode interpreter, compiled to machine code by wazero's AOT compiler on amd64 and arm64 | JIT compiler, or bytecode interpreter with `--jitless` |\n| Pure Go | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ |\n| `unsafe`-free | ⚠️ Except for OS API access | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ |\n| ECMAScript | ES2026 | ES5.1, and much of ES2015 and later | ES5.1, and much of ES2015 and later | ES5 | ES2023 | ES2023 | ES2025 |\n| Modules | ✅ | ❌ | ⚠️ Experimental | ❌ | ✅ | ✅ | ❌ |\n| `Intl` | ✅ | ❌ | ❌ | ❌ | ⚠️ `DateTimeFormat` and `NumberFormat` in en-US | ❌ | ✅ |\n| `Temporal` | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |\n\n- Investigated on 2026-11-16, with goja and Sobek at their latest commits.\n- Sobek is the fork of goja that k6 uses.\n- v8go is the fork of [rogchap.com\u002Fv8go](https:\u002F\u002Fgithub.com\u002Frogchap\u002Fv8go) that follows V8's\n  releases.\n\nEkuma uses the following techniques to improve performance:\n\n- Objects have hidden-class shapes, and named property accesses use inline caches.\n- Dense array elements use contiguous storage with direct indexed access.\n- The bytecode is register based, with fused compare-and-jump and constant-operand instructions.\n- Ordinary JavaScript calls reuse stack storage within the interpreter loop, without Go recursion.\n- Proper tail calls reuse the current frame for eligible strict-mode calls.\n- Values occupy two words on 64-bit platforms; numbers and signed 64-bit BigInts are stored inline.\n  Short primitive strings can also store up to eight WTF-8 bytes inline, avoiding a separate\n  heap object.\n- Eligible forwarding calls such as `f.apply(this, arguments)` avoid creating an arguments object.\n- Memory is managed by Go's garbage collector, without reference counting.\n- Strings use [WTF-8](https:\u002F\u002Fsimonsapin.github.io\u002Fwtf-8\u002F) with exact UTF-16 semantics;\n  well-formed strings cross the Go boundary without transcoding.\n- Repeated string appends and prepends can reuse growing buffers, preserving earlier string values.\n  Known ASCII operands can extend those buffers directly.\n- Multi-part string concatenation sizes its output before copying and can assemble small results\n  in stack scratch space.\n\n## Performance\n\nTime relative to Ekuma, as the geometric mean over the benchmarks of each suite (lower is\nfaster):\n\n\u003C!-- BEGIN jsbench summary -->\n\n```\n                     V8 benchmark  QuickJS\n                     suite v7      microbench    Version\nEkuma                 1.00         1.00          v0.0.0-20261118193413-b9d4e40e8453\ngoja                  4.80         4.03          v0.0.0-20261117122431-0802ca125248\nSobek                 4.75         4.00          v0.0.0-20261116133901-d070e0f1f200\notto                 23.0 (9\u002F10)    n\u002Fa          v0.5.1\nmodernc.org\u002Fquickjs   3.49         2.84          v0.27.0\nQJS                   4.64 (6\u002F10)  4.46 (69\u002F74)  v0.0.6\nQuickJS (C)           1.07         0.754         v0.0.0-20260604125329-3d5e064e9dd6\nv8go --jitless        0.596        0.511         v0.44.0\nv8go                  0.0304       0.0983        v0.44.0\n```\n\nMeasured on 2026-11-19: Apple M3 Pro, macOS 27.2, go1.27.4.\n\n\u003C!-- END jsbench summary -->\n\n- For reference, the results include QuickJS compiled from the C source used by\n  modernc.org\u002Fquickjs, and v8go with and without V8's JIT compilers.\n- \"(k\u002Fn)\" means that k of the n benchmarks had successful paired results for that engine and\n  Ekuma; the mean covers those benchmarks. otto cannot parse microbench.js, which uses ES2015\n  syntax. Failed rounds are excluded from timing ratios.\n- See [`_bench`](_bench\u002FREADME.md) for the benchmarks, measurement methodology, and individual\n  results.\n\n## Host API\n\nThe API follows [`syscall\u002Fjs`](https:\u002F\u002Fpkg.go.dev\u002Fsyscall\u002Fjs) where it can:\n`Value.Get`, `Value.Set`, `Value.Call`, `Value.Invoke`, `Value.New`, `VM.ValueOf`, `VM.FuncOf`,\n`CopyBytesToGo`, `CopyBytesToJS`.\nUnlike `syscall\u002Fjs`, a JavaScript exception is returned as an error, and the methods that run\na script or call a function take a `context.Context` that can cancel execution.\n`Value.GetWithValueKey`, `Value.SetWithValueKey`, `Value.DeleteWithValueKey` and\n`Value.CallWithValueKey` take the property key as a value, such as a symbol.\n`VM.NewArrayBuffer` makes an `ArrayBuffer` over a Go byte slice without copying, which only\n`VM.DetachArrayBuffer` detaches, as WebAssembly memory needs when it grows.\n\n### Scripts\n\n`VM.ParseScript` parses a script for a VM, and `Script.Evaluate` evaluates it, as often as\nneeded. A host that runs the same script in many VMs can parse it once with\n`ParseUnboundScript` and give each VM its own `Script` with `VM.BindScript`, which does not\nparse it again. An `UnboundScript` is immutable, and VMs on different goroutines may bind it\nat the same time.\n\n### Modules\n\nUse `VM.ParseModule` or `VM.ParseJSONModule` to parse a module, or `VM.NewSyntheticModule` to\ncreate a synthetic module. The host supplies imported modules through `VM.SetModuleLoader`,\nwhich also handles `import()`. Module loading is synchronous.\n\n`Module.Evaluate` loads, links and evaluates a module and returns a promise whose state can\nbe read with `Value.PromiseState`. `Module.LoadRequestedModules`\nand `Module.Link` perform the loading and linking steps separately.\n\n`Module.Namespace` returns the module namespace, and `VM.SetImportMeta` sets the properties\nof `import.meta`.\n\n### Realms\n\n`VM.NewRealm` creates a realm: a global object with its own built-in objects, in which\n`Realm.ParseScript`, `Realm.BindScript`, `Realm.ParseModule`, `Realm.ValueOf` and\n`Realm.FuncOf` work. The methods of `VM` work in `VM.InitialRealm`. `ModuleRequest.Realm`\ntells the module loader the realm of an import, including that of a `ShadowRealm`.\n\nThe realms of a VM share its jobs and settings, and values pass between them, so a realm\nis not a security boundary: an object of a realm gives access to its built-in objects.\nA separate `VM` isolates code.\n\n### Promises\n\n`VM.NewPromise` returns a pending promise and a `PromiseResolver`, which the host keeps to\nsettle the promise later, for example when a goroutine posts the result of I\u002FO back to the\ngoroutine that uses the VM. `PromiseResolver.Resolve` and `PromiseResolver.Reject` settle it as\nthe resolving functions of a JavaScript promise do, and run the pending jobs like other calls\nfrom Go. `Value.PromiseState` reads the state of any promise.\n\n### Jobs\n\nPending promise jobs run before the outermost Go call that executes JavaScript returns,\nincluding property operations and calls that throw. Calls reentered from host callbacks leave\njobs to the outermost call. An interruption discards pending jobs. Rejections still unhandled\nafter draining are reported to `VM.SetUnhandledRejection`.\n\n`VM.WithContinuationData` calls a function with a host value as the continuation data, which\n`VM.ContinuationData` returns. A promise job, including the continuation of an `await`, runs\nwith the continuation data that was current when it was registered, so the host can carry\nrequest-scoped state such as an AsyncLocalStorage frame across asynchronous code.\n\n### Cancellation\n\nA context stops everything that runs under it. When a `Func` makes a call with another\ncontext and that context stops the call, the outermost call returns the cause of that context\nand the `Func` does not continue. A context that is done after its call returned stops\nnothing. Operations without a context can run JavaScript and jobs without a cancellation\nlimit, unless reentered under a call with a context.\n\n### Panics\n\nA panic of a `Func` or of another host function passes through to the caller of the\nGo call unchanged and leaves the VM usable. A host callback may also recover a panic from\nits reentrant call and continue.\n\nAfter a panic, pending jobs and unhandled rejection reports are discarded at the outermost\nboundary, and unfinished module evaluations are rejected, even if\nan inner panic was recovered. Synchronous module evaluations abandoned by a panic are\nrejected before control returns to the host. Side effects are not rolled back.\n\nAborted generators are closed without running JavaScript `catch` or `finally` blocks.\nPromises for abandoned async functions, async generator requests, and discarded jobs may\nremain pending; later requests\non an aborted async generator see it as completed. Suspended generators outside the aborted\ncall remain intact.\n\nHost callbacks must not call `runtime.Goexit`: it is not a panic and leaves the VM unusable.\n\n### Time and randomness\n\n`Date` and `Temporal` use\nthe local time zone of Go's `time` package, or of the JavaScript host with `GOOS=js`, unless\n`VM.SetTimeZone` sets one. `VM.SetClock` sets the clock of the current time, and\n`VM.SetRandomSource` the source of `Math.random`.\n\n### Intl\n\nImporting `github.com\u002Fhajimehoshi\u002Fekuma\u002Fintl` for its side effects adds `Intl` to every VM.\nIt enables locale-aware formatting for the `toLocale*String` methods of numbers, dates,\ndurations, arrays and typed arrays, and locale-aware behavior for `localeCompare`,\n`toLocaleUpperCase` and `toLocaleLowerCase`. It also adds the ECMA-402 calendars to `Temporal`,\nin addition to `iso8601`:\n\n```go\nimport _ \"github.com\u002Fhajimehoshi\u002Fekuma\u002Fintl\"\n```\n\nWithout the import, these features do not contribute to binary size. With it, a hello-world\nprogram grows from about 8.9 MiB to 16.0 MiB natively, and from 11.4 MiB to 18.8 MiB with `GOOS=js`.\n\nSet the VM default locale with `vm.SetLocale(\"ja-JP\")`; `vm.SetLocale(\"\")` restores\nthe host default. Explicit JavaScript locale arguments take precedence, and existing\nIntl instances keep their locale.\n\nThe host default comes from `LC_ALL`, `LC_MESSAGES` or `LANG`, in that order, then\nthe OS locale: user preferences on macOS, iOS, and Windows, system properties on\nAndroid, or system locale configuration on Linux.\nFreeBSD, OpenBSD, NetBSD, and DragonFly BSD use the locale environment variables\nsupplied by the login session or shell. Browser builds use `navigator.language`.\nUnavailable host locales, `C` and `POSIX` fall back to en-US.\n\nThe native locale calls on Apple platforms and Android use purego. Android builds\nwith `CGO_ENABLED=0` use only the locale environment variables. iOS builds require\n`CGO_ENABLED=1`; macOS supports `CGO_ENABLED=0`.\n\nPrograms using the package must include the license notice for its locale data:\nsee [License](#license).\n\n### Agents\n\nVMs on different goroutines share the memory of a `SharedArrayBuffer` as agents do:\n`Value.SharedDataBlock` returns the memory, which `VM.ValueOf` turns into a new\n`SharedArrayBuffer` of another VM.\n\n`Atomics.wait` throws unless `VM.SetCanBlock` lets the VM block. When another VM notifies\na waiter of `Atomics.waitAsync`, its promise is settled by the\njobs that the waiting VM runs at the end of its current or next outermost call from Go.\n`VM.AwaitJobs` blocks until such a waiter is notified or times out, and runs the jobs.\n\n## Status\n\n53,791 of the 53,795 tests of [test262](https:\u002F\u002Fgithub.com\u002Ftc39\u002Ftest262) pass (99.99%). The other\n4 fail for known reasons, which [`testdata\u002Ftest262-skips.txt`](testdata\u002Ftest262-skips.txt) lists.\n\n### Implemented\n\n- Nearly all of the syntax and standard library up to ES2026 and Annex B, with `RegExp` on its own\n  backtracking engine\n- `Temporal`, explicit resource management, `import defer`, and the newer `Error`, `Iterator`,\n  `Promise` and `ArrayBuffer` additions\n- `ShadowRealm`, which is a proposal and not yet standard\n- Decorators, auto-accessors (`accessor`) and decorator metadata (`Symbol.metadata`), which are\n  proposals and not yet standard\n\n### Notes on behavior\n\n- Without [Intl](#intl), `Temporal` supports only the `iso8601` calendar. Named time zones require\n  the system's time zone database, or one in the directory that `ZONEINFO` names\n- Without [Intl](#intl), `toLocale*String` uses a fixed English format, `localeCompare`\n  compares code units after Unicode normalization, and `toLocaleUpperCase` and\n  `toLocaleLowerCase` ignore the locale. With Intl, these methods use locale-aware behavior\n- `Intl.Collator` follows the CLDR root collation, in which Han characters sort by code point,\n  and the tailorings of CLDR; ICU sorts Han by radical and stroke in the root\n- `Intl.Segmenter` follows UAX #29 without dictionaries, so it does not split Chinese, Japanese\n  or Thai text into words\n- `Intl.DisplayNames` gives the code of a language, or `undefined` with `fallback: \"none\"`, when\n  one of its subtags has no name, where ICU names the other subtags\n- `Intl.DurationFormat` separates the fields of the `digital` style as CLDR's duration patterns\n  do, such as `1.02.03` in Serbian, where ICU uses the time separator\n- A BigInt has at most 2^30 bits, as in V8: an operation or a conversion whose result would be\n  larger throws a RangeError, and a larger literal is a SyntaxError. `ValueOf` panics for a\n  larger `*big.Int`, and a `Func` that returns one throws a RangeError\n- Source phase imports and `%AbstractModuleSource%` exist, but importing the source of any\n  module throws a SyntaxError, since no host API gives a module a module source\n- `Function.prototype[Symbol.metadata]` is `null`, as the spec text of the decorator metadata\n  proposal defines it, so a class without decorators inherits `null` unless its superclass has\n  metadata\n- The `caller` and `arguments` properties of sloppy functions, a legacy extension that the\n  specification leaves to implementations, are accessors of each function. Browsers instead\n  change the accessors of `Function.prototype`, which the specification defines to throw. As in\n  SpiderMonkey, `caller` is `null` for a call from strict code, a generator, an async function or\n  a built-in function. A proper tail call from strict code leaves no frame of the strict\n  function, so the function that it calls sees the caller of the strict function instead\n\n### Missing\n\nHost API for these, some of which the engine has and only the tests use:\n\n- Giving a module a module source\n- Property descriptors, and listing the keys of an object\n- Limits on stack depth or memory, and statistics of the memory that a VM uses\n\n## Running the tests\n\n```sh\ngo test .\u002F...\n```\n\nThe test262 run is skipped unless a checkout of the suite is found in `ekuma\u002Ftest262`\nunder the user cache directory, or in the directory specified by `EKUMA_TEST262`.\nThe flags `-test262.filter`, `-test262.dir` and `-test262.shuffle` of the root package select and\norder its tests, and `-test262.report` writes the failing tests with their reasons to a file.\n\nLocal JavaScript regression tests in [`testdata\u002Fscripts`](testdata\u002Fscripts) use the\nsame runner as Test262 with an original 0BSD harness. The scripts and harness are read\nfrom `testdata` and run without a Test262 checkout, including with\n`go test -short .\u002F...`.\n\n## License\n\nEkuma is under [0BSD](LICENSE), except for the data of the\n[Unicode Common Locale Data Repository](https:\u002F\u002Fcldr.unicode.org\u002F) in `internal\u002Funicode\u002Fcldr`\nand its collation data in `internal\u002Funicode\u002Fcollation`, which are under the Unicode License v3\n([license](internal\u002Funicode\u002Fcldr\u002FLICENSE), [license](internal\u002Funicode\u002Fcollation\u002FLICENSE)). Only\nthe optional package `github.com\u002Fhajimehoshi\u002Fekuma\u002Fintl` includes this data, so only a program\nthat imports that package must include the copyright and permission notice of the Unicode\nLicense v3 with its copies or in their documentation.\n","Ekuma 是一个用纯 Go 编写的 JavaScript 引擎，不依赖 C 绑定或外部运行时，仅在访问操作系统 API 时使用少量 unsafe。它采用寄存器式字节码解释器，支持 ES2026 大部分语法与标准库（含模块、Intl、Temporal），具备隐藏类、内联缓存、稠密数组优化和尾调用优化等性能特性。项目强调内存安全与可嵌入性，API 尚不稳定，适用于需轻量、可控、无 CGO 依赖的 JS 执行场景，如配置脚本化、规则引擎、服务端沙箱执行等。","2026-11-24 04:50:48","CREATED_QUERY"]