A fully managed, NativeAOT-compatible JavaScript engine for .NET 8 / .NET 10 / .NET 11, built for embedded scripts, rules and plugins: low host-boundary cost, shareable compiled code, isolated realms, budgeted execution and explicit, reflection-free data mapping.
Status:
1.0.1(changelog). Design documents live indesign/; the implementation follows the route chosen indesign/01-research.md— Acornima parser → Jaunt scope analysis / register bytecode → managed register VM, with NativeAOT execution of post-publish source as a hard gate. Seedesign/07-implementation-status.mdfor the evidence behind each research conclusion, anddocs/FEATURES.mdfor the exact supported surface.
using Jaunt;
using var engine = new JsEngine();
engine.SetValue("price", 100.0);
engine.SetFunction("tax", (double amount) => amount * 0.13);
double total = engine.Evaluate("price * 2 + tax(price * 2)").AsNumber(); // 226Warm per-call time on the bench/cross workloads, Jaunt published with NativeAOT (commit f4f9969) against
QuickJS 2026-06-04 (release build, default Makefile) and MoeJS at source 9341716 (2026-11-09, default options). Each
bar is the geometric mean, per category, of each workload's time divided by Jaunt's; lower is better. Only the 53 workloads
whose results match Node on all three engines are counted. Measured on an Apple M4 on 2026-11-10: the engines ran one after
another in 3 interleaved rounds, and each figure is the median of those rounds. Jaunt was fastest on 34 workloads, MoeJS
on 13 and QuickJS on 6. Script compilation is a different story: QuickJS compiles in about 0.88× Jaunt's time, and MoeJS
matches Jaunt. Methodology and more comparisons are in docs/benchmarks.md.
JsCompiler ── Acornima AST (discarded) ─▶ ScopeAnalyzer ─▶ CodeGen ─▶ verified, immutable bytecode (JsScript / JsModule)
│ shared by any number of engines/threads
JsEngine ── Realm (globals, lazily built intrinsics, module instances) ──┤
└─ Vm: register interpreter, heap frames (no CLR recursion for JS calls), per-realm inline caches,
job queue, budgets (time / work / depth / tracked bytes / output), cancellation
- Values: 16-byte
JsValue(GC-visible reference + 64-bit payload; doubles XOR-encoded sodefaultisundefined; references are never hidden in the bits). - Objects: hidden-class shapes + slots, dictionary fallback; shapes for
Object/Function/Array.prototyperoles are realm-independent and shared process-wide (lock-free reads, bounded growth), so FreshRealm workloads don't rebuild layouts per request. - Inline caches (own/prototype data, add-property transitions, globals, primitive string receivers) are realm-private feedback; compiled code holds no realm state.
- Intrinsics are created lazily per group (Array, String, Map/Set, Promise, …) on first use; builtin layouts are predicted from the first realm and filled directly; builtin methods materialize on first read.
- NativeAOT: no
Reflection.Emit, expression compilation,DynamicInvokeor reflection fallback anywhere;eval/Functioncompile new Jaunt bytecode at run time and work in AOT binaries.
| Need | API |
|---|---|
| evaluate source / reuse compiled code | engine.Evaluate(string), JsCompiler.CompileScript → engine.Evaluate(JsScript) |
| ES modules | JsCompiler.CompileModule, engine.LoadModule(module, resolver), LoadModuleAsync (top-level await), instance.GetFunction (fixed) / GetExport (live binding) |
| call JS from C# | engine.Invoke(fn, a0, a1), InvokeWithThis, InvokeAsync |
| host functions | typed SetFunction<T1,…,TR> (static adapters), raw JsNativeFunction(ref JsCallContext), SetAsyncFunction |
| one budget for a whole request | engine.BeginExecution(options, token) → ParseJson / Invoke / ToJsonUtf8 / FromObject / ToObject → Complete() |
| DTO mapping | JsTypeInfo.Object<T>()…Build() by hand, or [JsSerializable(typeof(T))] partial class X : JsBindingContext (the source generator ships in the Jaunt package) |
| production plugins | JsPlugin.Create(module, "export", inInfo, outInfo, options) → FreshRealm per call, bounded concurrency |
| limits / isolation | JsLimits (Timeout, MaxInstructions, MaxStackDepth, MaxTrackedBytes, MaxOutputBytes, …), JsProfile.Hardened |
Errors: JsCompileException (with code/line/column), JsException (JS throw; engine stays usable),
JsLimitExceededException / OperationCanceledException (engine faulted), JsAsyncRequiredException,
JsEngineFaultedException (UnjoinedAsyncWork, internal errors), JsConversionException (member path).
| Path | Content |
|---|---|
src/Jaunt |
the engine (net8.0;net10.0, plus net11.0 when built with the .NET 11 SDK) |
src/Jaunt.Generators |
Roslyn source generator for DTO bindings (diagnostics JAUNT001–JAUNT005) |
tests/Jaunt.Tests |
xUnit: language semantics, API contracts, limits, isolation, modules, async, DTO/JSON, generator |
samples/Jaunt.AotHost |
NativeAOT consumer host used by the release gate; its bench subcommand measures hot-path throughput under NativeAOT vs CoreCLR JIT |
bench/Jaunt.Benchmarks |
BenchmarkDotNet suites + --quick harness, compared with Jint 4.17.0 |
bench/cross |
shared workload corpus, cross-engine protocol (dotnet/CrossProtocol.cs), run.sh (Jaunt/Jint/MoeJS) and aot-vs-jit.sh (NativeAOT vs JIT) |
tools/Jaunt.Test262 |
test262 runner (pinned revision, feature-manifest skips, per-variant results) |
eng/verify-aot.sh |
publishes the AOT host for net8.0/net10.0/net11.0, writes new JS after publishing, runs the native binaries |
eng/verify-package.sh |
checks a .nupkg and installs it into a fresh consumer project that runs JS and the bundled generator |
docs/ |
feature manifest, benchmark and conformance reports |
dotnet test tests/Jaunt.Tests # unit + contract tests
./eng/verify-aot.sh # NativeAOT gate (needs .NET 10 SDK; .NET 11 SDK via eng/sdk11)
dotnet run -c Release --project bench/Jaunt.Benchmarks -- --quick
dotnet run -c Release --project bench/Jaunt.Benchmarks -- --filter '*' # BenchmarkDotNet
bench/cross/aot-vs-jit.sh # hot-path throughput: NativeAOT binary vs the same host on CoreCLR
git -C artifacts/test262 checkout 045bf6f9966ce3291b8fbc1e0403cd97b9201b00 # see docs/test262.md
dotnet run -c Release --project tools/Jaunt.Test262 -- artifacts/test262The SDK used for the stable channel is pinned in global.json; NativeAOT/runtime packs are pinned to patched
servicing releases in Directory.Build.targets.
Jaunt is a library, so these are settings of your application's project. For hosts that care about script throughput:
<PublishAot>true</PublishAot>
<OptimizationPreference>Speed</OptimizationPreference>On the benchmark corpus Speed was about 2% faster overall and about 6% faster at compiling scripts, for about 0.3 MB of
binary size and about 2% on the first call. Measurements and the GC settings that were tried are in
docs/benchmarks.md.
Pushing a tag such as v1.0.1 runs .github/workflows/release.yml: the full
verification matrix, then pack and a consumer test, then a push to nuget.org. The tag is the package version.
Publishing uses NuGet Trusted Publishing, so no API
key is stored; the required nuget.org policy and NUGET_USER secret are listed at the top of the workflow.
Jaunt follows Semantic Versioning from 1.0.0. The public API is the public types and members of the
Jaunt assembly and the [JsSerializable] source generator's contract; a breaking change to them needs a new major version.
Not covered: bytecode and disassembly formats, error message and stack text, Intl output (it follows the platform ICU),
and performance figures. Changes that bring JavaScript behaviour closer to the specification ship in minor or patch
releases. The supported surface is listed in docs/FEATURES.md.
Jaunt is licensed under the MIT License. Third-party obligations (Acornima, BSD-3-Clause)
are listed in THIRD_PARTY_NOTICES.md.