Skip to content

Releases: ursm/rusty_racer

v0.1.3

14 Jun 04:42
59fa514

Choose a tag to compare

Highlights

Catchable per-isolate memory_limit (#5) — the space-axis twin of timeout_ms.

iso = RustyRacer::Isolate.new(memory_limit: 64 * 1024 * 1024)
iso.context.eval("a = []; for (;;) a.push(new Array(1e6))")  # raises RustyRacer::V8OutOfMemoryError
iso.context.eval("1 + 1")                                    # => 2 (still usable)

A script that exceeds the configured V8 heap ceiling is terminated and raises RustyRacer::V8OutOfMemoryError (< EvalError) instead of aborting the process, and the isolate recovers (forced GC + ceiling reset) so it stays usable. Both resource axes — time (timeout_ms) and space (memory_limit) — are now catchable, so one runaway script fails just its own eval, not the whole process (the test-driver use case). memory_limit defaults to 0 (no limit); it is a soft limit, enforced at GC granularity.

Internals: V8's near-heap-limit callback flags + terminates + doubles the ceiling for the unwind, Core::run reclaims and resets; the OOM terminate is forced through the request bracket so a microtask / top-level-await drain OOM can't surface as a bogus success.

Full Changelog: v0.1.2...v0.1.3

v0.1.2

13 Jun 07:52
86c98b6

Choose a tag to compare

Optional ExecJS runtime adapter

Any ExecJS consumer (asset pipelines, CoffeeScript/Babel/Uglify wrappers, …) can now run on rusty_racer with no code change:

require "rusty_racer/execjs"
ExecJS.runtime = RustyRacer::ExecJSRuntime.new
  • Opt-inrusty_racer never requires execjs itself, so execjs stays a non-dependency.
  • Values cross with ExecJS's JSON semantics (functions/undefined drop out, Dates become ISO strings), matching ExecJS's external runtimes.
  • Verified against a port of ExecJS's own runtime contract suite.

See the ExecJS section of the README.

Docs

  • README Highlights + an honest Compared to mini_racer section.
  • RubyGems metadata (source / bug-tracker links, MFA).

Internal

  • lib.rs split into focused modules (dispatch handlers, marshalling, watchdog, stack); watchdog state encapsulated. No core API change.

Full Changelog: v0.1.1...v0.1.2

rusty_racer 0.1.1

12 Jun 14:04
fc36f4b

Choose a tag to compare

simdutf — faster non-ASCII string marshalling

V8→Ruby string conversion (every eval result, object key, error message, …) now uses simdutf's SIMD-accelerated UTF-8/UTF-16 transcoding, via rusty_v8's simdutf feature.

  • ~6–8× faster marshalling of non-ASCII results — Japanese/CJK, accented (Latin-1), emoji/surrogate text. Measured: Japanese (UTF-16) 98→15 µs (~6.5×), Latin-1 129→16 µs (~8×).
  • ASCII is unchanged (it already took a fast path).
  • Transparent: no API change. Transcoding round-trips remain byte-perfect across empty/ASCII/Latin-1/Japanese/surrogate-emoji/mixed inputs.

Precompiled gems bundle V8 with simdutf for Ruby 3.3/3.4/4.0 on Linux (x86_64, arm64) and macOS (arm64, x86_64). No change needed to use it.

rusty_racer 0.1.0

12 Jun 11:11
9fdfdb3

Choose a tag to compare

First release. Embed V8 in Ruby, built on rusty_v8 and Magnus via rb-sys.

iso = RustyRacer::Isolate.new(timeout_ms: 1000)
ctx = iso.context
ctx.eval("1 + 1")                        # => 2
ctx.eval("({a: 1, b: [true, 'x']})")     # => {"a"=>1, "b"=>[true, "x"]}
ctx.attach("rubyUpcase", ->(s) { s.upcase })
ctx.eval("rubyUpcase('hi')")             # => "HI"

Highlights

  • In-thread execution. Each Isolate runs V8 on the Ruby thread that created it (the GVL is released around the JS run) and is thread-confined — every op runs on the owner thread or raises WrongThreadError. #terminate is the one exception (safe from any thread). Capybara/Enumerator (Fiber) evals on the main thread are supported.
  • Values round-trip faithfully — BigInt, Date, Map, Set, and shared references all marshal both ways. JS errors carry the JS stack as the Ruby backtrace.
  • Ruby ↔ JS callbacksattach a Ruby proc; a raised Ruby exception becomes a JS exception, and vice versa, across re-entrant calls.
  • ES modules and classic scripts, with the embedder owning the module registry; bytecode caching (cold produce_cache: and warm create_code_cache) and eager: compile.
  • Snapshots, extra same-origin realms (create_context), manual/auto microtask checkpoints, Context#reset, dynamic import(), and Isolate#terminate.

Install

Precompiled gems bundle V8 (no V8 build, no Rust toolchain) for Ruby 3.3, 3.4, and 4.0 on Linux (x86_64, arm64) and macOS (arm64, x86_64):

gem "rusty_racer"

Other platforms build the extension from source — see the README.

Early and experimental — the API still moves.

librusty_v8 v150.0.0 (library-TLS)

11 Jun 13:29

Choose a tag to compare

Pre-release

library-TLS librusty_v8.a built from the denoland/rusty_v8 v150.0.0 git checkout (which has the full third_party the crates.io tarball lacks). Consumed by cibuildgem.yaml via RUSTY_V8_ARCHIVE, so the gem CI links a prebuilt V8 instead of a 30-45 min source build.