mini_racer_rs 1.5.1 → 1.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 34e3c7be1437cb48571d429539787241ee6056f1157f2ee4946caf3a08e0d41a
4
- data.tar.gz: 4cb4111cfa8670145d793a55099a04f101f494af4732d0fa840da9599308a0c5
3
+ metadata.gz: e86ed50c4fed6c7f1bbf5276e15277182938a0c11aa1ada7e385d74cc5db4ec0
4
+ data.tar.gz: 75aa12887ad5afff7aeb3073a43b0eda296eb664eadfdda84f24b93db31bd033
5
5
  SHA512:
6
- metadata.gz: 8bd82f6313e99898bf053818a937e6089b409e662c5f304f1191df3ae90d11cfd99ee84861ec5bc9a651599c1a02fa2d778e4726fa543cb38306364517d9ac77
7
- data.tar.gz: 0455a6d7c65f98d44fb079af4de1894547cfe942116a3407513da5810935e08a3ddf62673e605ee15e371b2cf71b84c0602b38559d51a831f356eff93fb2db38
6
+ metadata.gz: 5e3b56230941049091937320488d063974d20abc228dc9471dab3195d0202fd1a4c1a26cbfb3973790434c3efaffe22e47a1af2511fae9fbaafe709f8e8fb0bd
7
+ data.tar.gz: bd0f079417fa2f08d1e4bfeb7525ba015aeb9033e85fb1c18bdf9964da5f65f33b8c61caf41d87eb5defe329592ac6e77b42754594565d543ae86910d40e9632
data/.yardopts ADDED
@@ -0,0 +1,7 @@
1
+ --markup markdown
2
+ --exclude lib/mini_racer/truffleruby.rb
3
+ --exclude lib/mini_racer/shared.rb
4
+ lib/**/*.rb
5
+ -
6
+ COMPATIBILITY.md
7
+ CHANGELOG.md
data/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.5.3](https://github.com/andymai/mini_racer_rs/compare/v1.5.2...v1.5.3) (2026-10-24)
4
+
5
+
6
+ ### Performance
7
+
8
+ * **engine:** cache a large first sighting that runs as long as it compiles ([#159](https://github.com/andymai/mini_racer_rs/issues/159)) ([47cc0cc](https://github.com/andymai/mini_racer_rs/commit/47cc0ccd76c5d39ec3c9005b848e5846e213d618))
9
+ * **engine:** cache a script again after its builder's next call ([#160](https://github.com/andymai/mini_racer_rs/issues/160)) ([8f632e0](https://github.com/andymai/mini_racer_rs/commit/8f632e065ec3506687d69e8e13f0df56b2e21064))
10
+ * **engine:** cache scripts from 128 KiB and keep 64 caches ([#158](https://github.com/andymai/mini_racer_rs/issues/158)) ([0b77e64](https://github.com/andymai/mini_racer_rs/commit/0b77e640d311db4c22d711a884be5aeadbcc0e0b))
11
+
12
+ ## [1.5.2](https://github.com/andymai/mini_racer_rs/compare/v1.5.1...v1.5.2) (2026-10-24)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * **ext:** keep set_flags! values rooted and stop dropping interrupts in waits ([#152](https://github.com/andymai/mini_racer_rs/issues/152)) ([b32e5cd](https://github.com/andymai/mini_racer_rs/commit/b32e5cd22a1f0f36cc4fa1e7b516c8867829b70f))
18
+ * **pool:** build replacements outside the timeout scope and root shutdown's queues ([#151](https://github.com/andymai/mini_racer_rs/issues/151)) ([60b292d](https://github.com/andymai/mini_racer_rs/commit/60b292df11e7802b9b8429848788176698b463e9))
19
+
20
+
21
+ ### Performance
22
+
23
+ * **engine:** decode a shared UTF-8 source in place ([#155](https://github.com/andymai/mini_racer_rs/issues/155)) ([f37538f](https://github.com/andymai/mini_racer_rs/commit/f37538fa2931438c4cd5a40d7647d2bbfc92d356))
24
+ * **engine:** remember 4,096 sightings of large scripts ([#156](https://github.com/andymai/mini_racer_rs/issues/156)) ([656b60f](https://github.com/andymai/mini_racer_rs/commit/656b60fe62c976ae06786460bb24004c127dccd8))
25
+
3
26
  ## [1.5.1](https://github.com/andymai/mini_racer_rs/compare/v1.5.0...v1.5.1) (2026-10-23)
4
27
 
5
28
 
data/Cargo.lock CHANGED
@@ -593,7 +593,7 @@ checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
593
593
 
594
594
  [[package]]
595
595
  name = "mini_racer_engine"
596
- version = "1.5.1"
596
+ version = "1.5.3"
597
597
  dependencies = [
598
598
  "deno_core_icudata",
599
599
  "libc",
@@ -606,7 +606,7 @@ dependencies = [
606
606
 
607
607
  [[package]]
608
608
  name = "mini_racer_rs"
609
- version = "1.5.1"
609
+ version = "1.5.3"
610
610
  dependencies = [
611
611
  "magnus",
612
612
  "mini_racer_engine",
@@ -617,7 +617,7 @@ dependencies = [
617
617
 
618
618
  [[package]]
619
619
  name = "mini_racer_sourcemap"
620
- version = "1.5.1"
620
+ version = "1.5.3"
621
621
  dependencies = [
622
622
  "memchr",
623
623
  "serde",
@@ -627,7 +627,7 @@ dependencies = [
627
627
 
628
628
  [[package]]
629
629
  name = "mini_racer_sync"
630
- version = "1.5.1"
630
+ version = "1.5.3"
631
631
  dependencies = [
632
632
  "loom",
633
633
  "thiserror",
@@ -635,7 +635,7 @@ dependencies = [
635
635
 
636
636
  [[package]]
637
637
  name = "mini_racer_wire"
638
- version = "1.5.1"
638
+ version = "1.5.3"
639
639
  dependencies = [
640
640
  "criterion",
641
641
  "proptest",
data/Cargo.toml CHANGED
@@ -15,7 +15,7 @@ license = "MIT"
15
15
  publish = false
16
16
  repository = "https://github.com/andymai/mini_racer_rs"
17
17
  rust-version = "1.91"
18
- version = "1.5.1"
18
+ version = "1.5.3"
19
19
 
20
20
  [workspace.dependencies]
21
21
  criterion = {version = "0.8", default-features = false, features = ["cargo_bench_support"]}
data/README.md CHANGED
@@ -21,9 +21,9 @@ mini_racer_rs implements the `MiniRacer` API from mini_racer 0.22.2. It defines
21
21
 
22
22
  ## Highlights
23
23
 
24
- - **Round trips:** 5 to 9 times faster (0.75 µs vs 6.45 µs per call).
25
- - **Babel through ExecJS:** 1.97x faster (5.11 ms vs 10.06 ms).
26
- - **Bundle load:** 4.6x faster for a 44 MB production server rendering bundle (215 ms vs 983 ms).
24
+ - **Round trips:** 5 to 9 times faster (0.75 µs vs 6.50 µs per call).
25
+ - **Babel through ExecJS:** 1.93x faster (5.09 ms vs 9.85 ms).
26
+ - **Bundle load:** 9.2x faster for a 44 MB production server rendering bundle (105 ms vs 965 ms).
27
27
  - **Memory:** A context holding the MUI bundle uses 43 MB vs 110 MB.
28
28
  - **Forks:** After loading and rendering React: 20 of 20 clean mini_racer_rs exits vs 20 of 20 mini_racer aborts.
29
29
  - **V8:** V8 15.2.124.1 vs V8 13.6.233.17 in mini_racer 0.22.2.
@@ -33,7 +33,7 @@ mini_racer_rs implements the `MiniRacer` API from mini_racer 0.22.2. It defines
33
33
  - **Callback jumps:** A `throw` out of an attached callback ends the script with `Error: terminated` and continues after `eval`; mini_racer 0.22.2 crashes with a segmentation fault.
34
34
  - **Checks:** Script-enforced crate boundaries, four fenced `unsafe` modules, loom, wire-codec fuzzing, nightly sanitizers and mini_racer differential tests.
35
35
 
36
- These numbers compare with mini_racer 0.22.1. See [Benchmarks](#benchmarks) for the method.
36
+ The round trip, Babel, memory, fiber scheduler, and bundle load numbers compare with mini_racer 0.22.2, while the fork numbers compare with mini_racer 0.22.1. See [Benchmarks](#benchmarks) for the method.
37
37
 
38
38
  ## Install
39
39
 
@@ -208,43 +208,43 @@ The repository tests the `path:` form of the shim with rtlcss in `test/consumers
208
208
 
209
209
  ### Forking servers such as Puma
210
210
 
211
- Before forking, evaluate each bundle of 1 MiB or more twice in the master, then dispose those contexts. Use the renderer's exact source text and file name. The second evaluation builds the process-wide V8 code cache. Matching evaluations compile from it, and forked children inherit it. For Babel's 2.3 MB bundle at commit `5e13c1c`, a forked child's first load took 60.8 ms without a parent load. It took 65.5 ms after one load and 25.0 ms after two. These are medians across 5 trials. Prime a `react-rails` app by building its server renderer twice. Children do not use parent contexts. Only the cache carries over.
211
+ Before forking, evaluate each bundle of 128 KiB or more twice in the master, then dispose those contexts. Use the renderer's exact source text and file name. The second evaluation builds the process-wide V8 code cache, or the first for a bundle of 16 MiB or more whose top-level code runs at least as long as it compiles. Matching evaluations compile from the cache, and forked children inherit it. The context that built a cache rebuilds it once after its next call, so a render in the master also gives children the functions that render compiled. For Babel's 2.3 MB bundle at commit `5e13c1c`, a forked child's first load took 60.8 ms without a parent load. It took 65.5 ms after one load and 25.0 ms after two. These are medians across 5 trials. Prime a `react-rails` app by building its server renderer twice. Children do not use parent contexts. Only the cache carries over.
212
212
 
213
213
  For Ruby's `fork`, `IO.popen("-")`, or `Process.daemon`, mini_racer_rs waits for context runners, pauses its worker pool and waits for running tasks. An async `WebAssembly.compile` in a new default-mode child completes on the child's own pool. On Ubuntu 24.04 with glibc 2.39, 20 of 20 mini_racer 0.22.1 children aborted with signal 6 after React rendering; all mini_racer_rs children exited cleanly. mini_racer 0.22.2 has the same fork handling. On Fedora, `test/stress/fork_busy.rb` aborted with mini_racer 0.22.2 in 3 of 3 runs, after 5, 14 and 19 forks, when an evaluating parent thread raised `TypeError`. mini_racer_rs completed 300 forks per run on Fedora and Ubuntu.
214
214
 
215
- With `mini_racer` 0.22.1, each worker compiles the bundle from source on its first load because it has no code cache.
215
+ With `mini_racer` 0.22.2, each worker compiles the bundle from source on its first load because it has no code cache.
216
216
 
217
217
  ## Benchmarks
218
218
 
219
- | Workload | mini_racer 0.22.1 | mini_racer_rs | Ratio |
219
+ | Workload | mini_racer 0.22.2 | mini_racer_rs | Ratio |
220
220
  |---|---:|---:|---:|
221
- | Babel transform of a 3 KB JSX component, through ExecJS | 10.1 ms | 5.1 ms | 2.0x |
222
- | Terser minify of a 78 KB library, through ExecJS | 51.4 ms | 50.9 ms | 1.0x |
223
- | React server render of 1,000 items (17 KB of HTML), through ExecJS | 192 µs | 182 µs | 1.1x |
221
+ | Babel transform of a 3 KB JSX component, through ExecJS | 9.8 ms | 5.1 ms | 1.9x |
222
+ | Terser minify of a 78 KB library, through ExecJS | 51.3 ms | 49.9 ms | 1.0x |
223
+ | React server render of 1,000 items (17 KB of HTML), through ExecJS | 192 µs | 175 µs | 1.1x |
224
224
  | React in a new context: load the bundle and render 1,000 items, through ExecJS | 11.8 ms | 11.8 ms | 1.0x |
225
- | Handlebars render of 50 rows, through `Context#call` | 49.0 µs | 34.7 µs | 1.4x |
226
- | Autoprefixer on Bootstrap's 280 KB stylesheet, through ExecJS | 26.2 ms | 23.8 ms | 1.1x |
227
- | MUI dashboard server render of 200 rows and 299 icons (469 KB of HTML), through ExecJS | 30.3 ms | 29.2 ms | 1.0x |
228
- | MUI in a new context: load the 8.2 MB bundle and render once, through ExecJS | 166 ms | 104 ms | 1.6x |
229
- | Load a 44 MB production server rendering bundle into a new context, through ExecJS | 983 ms | 215 ms | 4.6x |
225
+ | Handlebars render of 50 rows, through `Context#call` | 50.0 µs | 35.0 µs | 1.4x |
226
+ | Autoprefixer on Bootstrap's 280 KB stylesheet, through ExecJS | 26.0 ms | 24.0 ms | 1.1x |
227
+ | MUI dashboard server render of 200 rows and 299 icons (469 KB of HTML), through ExecJS | 31.4 ms | 29.2 ms | 1.1x |
228
+ | MUI in a new context: load the 8.2 MB bundle and render once, through ExecJS | 164 ms | 104 ms | 1.6x |
229
+ | Load a 44 MB production server rendering bundle into a new context, through ExecJS | 965 ms | 105 ms | 9.2x |
230
230
 
231
- Results are medians of 5 runs. Every workload produced identical output in both gems. The eight library workloads use one run of the Ruby 3.4 extension from the published mini_racer_rs 1.4.0 `x86_64-linux-gnu` gem. The 44 MB production bundle load uses commit `2513a48`. Benchmarks ran on Ruby 3.4.2 and Linux with an AMD Ryzen 9 7950X3D. The governor was `performance`. Both gems were pinned to CPUs 0 through 7.
231
+ Results are medians of 5 runs. Every workload produced identical output in both gems. The eight library workloads use one run of the Ruby 3.4 extension from the published mini_racer_rs 1.5.1 `x86_64-linux-gnu` gem against mini_racer 0.22.2. The 44 MB production bundle load uses a second run of the same gem against mini_racer 0.22.2. Benchmarks ran on Ruby 3.4.2 and Linux with an AMD Ryzen 9 7950X3D. The governor was `performance`. Both gems were pinned to CPUs 0 through 7.
232
232
 
233
- The per-call and memory figures below come from the same run of that extension on the same machine. One watchdog thread serves the whole process, making a call with `timeout:` fast. Scripts of 1 MiB or more use a process-wide V8 code cache. Contexts loading the same large script share one source copy.
233
+ The per-call and memory figures below come from the first run of that extension on the same machine, except the production bundle row, which comes from the second run. One watchdog thread serves the whole process, making a call with `timeout:` fast. Scripts of 128 KiB or more use a process-wide V8 code cache. Contexts loading the same script of 1 MiB or more share one source copy.
234
234
 
235
- | Measure | mini_racer 0.22.1 | mini_racer_rs |
235
+ | Measure | mini_racer 0.22.2 | mini_racer_rs |
236
236
  |---|---:|---:|
237
- | eval round trip | 6.76 µs | 1.14 µs |
238
- | call round trip | 6.45 µs | 0.75 µs |
239
- | callback round trip | 6.06 µs | 1.11 µs |
240
- | call on a context with `timeout:` | 20.50 µs | 0.78 µs |
241
- | call inside `MiniRacerRs.timeout` (mini_racer: on a context with `timeout:`) | 20.61 µs | 0.85 µs |
237
+ | eval round trip | 6.58 µs | 1.13 µs |
238
+ | call round trip | 6.50 µs | 0.75 µs |
239
+ | callback round trip | 6.13 µs | 1.11 µs |
240
+ | call on a context with `timeout:` | 20.42 µs | 0.78 µs |
241
+ | call inside `MiniRacerRs.timeout` (mini_racer: on a context with `timeout:`) | 20.22 µs | 0.87 µs |
242
242
  | Babel inside V8 | 10.3 ms | 5.3 ms |
243
- | startup plus Babel | 44.3 ms | 13.2 ms |
243
+ | startup plus Babel | 44.8 ms | 13.3 ms |
244
244
  | context holding Babel | 28.5 MB | 15.0 MB |
245
245
  | context holding the 8.2 MB MUI bundle | 110 MB | 43 MB |
246
- | context holding the 44 MB production bundle, at commit `2513a48` before sources were shared | 301 MB | 136 MB |
247
- | peak resident memory with 20,000 contexts left to Ruby's garbage collector | 2,910 MB | 106 MB |
246
+ | context holding the 44 MB production bundle | 301 MB | 44 MB |
247
+ | peak resident memory with 20,000 contexts left to Ruby's garbage collector | 2,918 MB | 108 MB |
248
248
 
249
249
  ```sh
250
250
  bundle exec ruby bench/run.rb --cpus 0-7
@@ -251,6 +251,7 @@ impl ContextHandle {
251
251
  process::ensure_initialized();
252
252
  // Read here, on the caller's thread, not first on a runner's.
253
253
  let _ = process::code_cache::enabled();
254
+ let _ = process::code_cache::first_override();
254
255
  let _ = process::fast_calls();
255
256
  let generation = fork::current();
256
257
  let block = Arc::new(ControlBlock::new(config));