Commit 238a0563

238a05638400Merged

Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 1 file · ~1 modified

Description

docs: rebase benchmark table against Ruby 4.0.4 with --yjit column

Replace the previous comparison against miniruby (Ruby 4.1.0dev) with CRuby 4.0.4 stable, run with --disable-gems for the baseline column and with --yjit for the JIT column. Each cell is the best of three wall-clock runs.

Geometric mean across the 28 listed benchmarks drops to 6.8x vs YJIT (from 11.6x vs the interpreter-only miniruby baseline). The ranking shape is unchanged: computation far ahead, GC-heavy roughly par. New observations the YJIT column makes visible:

  • Integer/float-loop benchmarks (mandelbrot, nqueens, matmul, partial_sums, sieve, fannkuch) are interpreter-bound; YJIT lands within noise of the interpreter and Spinel keeps its 16-56x lead.
  • Call-heavy code (ackermann, fib, tarai, tak, rbtree) is where YJIT does its real 4-6x work, and Spinel still wins on top.
  • json_parse is the one cell where YJIT (276 ms) is faster than Spinel (296 ms, 0.93x). Spinel's polymorphic-receiver String dispatch costs about 7% over YJIT's inlined path.

Co-Authored-By: Claude Opus 4.7 (1M context) [email protected]

Details

Commit
238a05638400
Parent
37805c2fe020

README.mdmodifiedView file

@@ -120,54 +120,64 @@
120120 ## Benchmarks
121121
122122 384 tests pass. 52 benchmarks pass.
123-Geometric mean: **~11.6x faster** than miniruby (Ruby 4.1.0dev) across
124-the 28 benchmarks below. Baseline is the latest CRuby `miniruby` build
125-(without bundled gems), which is considerably faster than the system
126-`ruby` (3.2.3); Spinel's advantage is correspondingly smaller but still
127-substantial on computation-heavy workloads.
123+Geometric mean: **~6.8x faster** than Ruby 4.0.4 with `--yjit` across
124+the 28 benchmarks below. Baseline is CRuby 4.0.4 (stable), run with
125+`--disable-gems` and with `--yjit` for the JIT column. Each timing is
126+the best of three wall-clock runs; sub-10 ms cells are dominated by
127+interpreter / runtime startup and should be read as "noise floor."
128128
129129 ### Computation
130130
131-| Benchmark | Spinel | miniruby | Speedup |
132-|---|---|---|---|
133-| life (Conway's GoL) | 20 ms | 1_733 ms | 86.7x |
134-| ackermann | 5 ms | 374 ms | 74.8x |
135-| mandelbrot | 25 ms | 1_453 ms | 58.1x |
136-| fib (recursive) | 17 ms | 581 ms | 34.2x |
137-| nqueens | 10 ms | 304 ms | 30.4x |
138-| tarai | 16 ms | 461 ms | 28.8x |
139-| tak | 22 ms | 532 ms | 24.2x |
140-| matmul | 13 ms | 313 ms | 24.1x |
141-| sudoku | 6 ms | 102 ms | 17.0x |
142-| partial_sums | 93 ms | 1_498 ms | 16.1x |
143-| fannkuch | 2 ms | 19 ms | 9.5x |
144-| sieve | 39 ms | 332 ms | 8.5x |
145-| fasta (DNA seq gen) | 3 ms | 21 ms | 7.0x |
131+| Benchmark | Spinel | Ruby 4.0.4 | + YJIT | Speedup vs YJIT |
132+|---|---|---|---|---|
133+| mandelbrot | 24 ms | 1_318 ms | 1_346 ms | 56.1x |
134+| nqueens | 9 ms | 310 ms | 309 ms | 34.3x |
135+| matmul | 9 ms | 300 ms | 301 ms | 33.4x |
136+| life (Conway's GoL) | 23 ms | 865 ms | 495 ms | 21.5x |
137+| partial_sums | 79 ms | 1_313 ms | 1_303 ms | 16.5x |
138+| sieve | 25 ms | 407 ms | 408 ms | 16.3x |
139+| sudoku | 5 ms | 102 ms | 53 ms | 10.6x |
140+| fannkuch | 2 ms | 15 ms | 15 ms | 7.5x |
141+| ackermann | 9 ms | 344 ms | 59 ms | 6.6x |
142+| fib (recursive) | 16 ms | 535 ms | 95 ms | 5.9x |
143+| fasta (DNA seq gen) | 3 ms | 14 ms | 15 ms | 5.0x |
144+| tarai | 27 ms | 399 ms | 69 ms | 2.6x |
145+| tak | 35 ms | 497 ms | 82 ms | 2.3x |
146146
147147 ### Data Structures & GC
148148
149-| Benchmark | Spinel | miniruby | Speedup |
150-|---|---|---|---|
151-| rbtree (red-black tree) | 24 ms | 543 ms | 22.6x |
152-| splay tree | 14 ms | 195 ms | 13.9x |
153-| huffman (encoding) | 6 ms | 59 ms | 9.8x |
154-| so_lists | 76 ms | 410 ms | 5.4x |
155-| binary_trees | 11 ms | 40 ms | 3.6x |
156-| linked_list | 136 ms | 388 ms | 2.9x |
157-| gcbench | 1_845 ms | 3_641 ms | 2.0x |
149+| Benchmark | Spinel | Ruby 4.0.4 | + YJIT | Speedup vs YJIT |
150+|---|---|---|---|---|
151+| so_lists | 35 ms | 483 ms | 303 ms | 8.7x |
152+| rbtree (red-black tree) | 21 ms | 520 ms | 114 ms | 5.4x |
153+| splay tree | 15 ms | 177 ms | 64 ms | 4.3x |
154+| binary_trees | 5 ms | 36 ms | 20 ms | 4.0x |
155+| huffman (encoding) | 17 ms | 63 ms | 64 ms | 3.8x |
156+| gcbench | 516 ms | 3_449 ms | 1_757 ms | 3.4x |
157+| linked_list | 67 ms | 299 ms | 224 ms | 3.3x |
158158
159159 ### Real-World Programs
160160
161-| Benchmark | Spinel | miniruby | Speedup |
162-|---|---|---|---|
163-| json_parse | 39 ms | 394 ms | 10.1x |
164-| bigint_fib (1000 digits) | 2 ms | 16 ms | 8.0x |
165-| ao_render (ray tracer) | 417 ms | 3_334 ms | 8.0x |
166-| pidigits (bigint) | 2 ms | 13 ms | 6.5x |
167-| str_concat | 2 ms | 13 ms | 6.5x |
168-| template engine | 152 ms | 936 ms | 6.2x |
169-| csv_process | 234 ms | 860 ms | 3.7x |
170-| io_wordcount | 33 ms | 97 ms | 2.9x |
161+| Benchmark | Spinel | Ruby 4.0.4 | + YJIT | Speedup vs YJIT |
162+|---|---|---|---|---|
163+| str_concat | 1 ms | 10 ms | 11 ms | 11.0x |
164+| ao_render (ray tracer) | 103 ms | 3_015 ms | 1_125 ms | 10.9x |
165+| bigint_fib (1000 digits) | 1 ms | 10 ms | 10 ms | 10.0x |
166+| pidigits (bigint) | 2 ms | 10 ms | 10 ms | 5.0x |
167+| csv_process | 250 ms | 1_046 ms | 922 ms | 3.7x |
168+| io_wordcount | 27 ms | 109 ms | 99 ms | 3.7x |
169+| template engine | 275 ms | 1_013 ms | 713 ms | 2.6x |
170+| json_parse | 296 ms | 413 ms | 276 ms | 0.93x |
171+
172+A few notes on what YJIT does and doesn't change. On some integer-loop
173+workloads (mandelbrot, nqueens, matmul, partial_sums, sieve) YJIT's
174+numbers are essentially identical to interpreted Ruby; the benchmark
175+is bound by integer / float operations that the interpreter already
176+runs at native speed. On call-heavy code (ackermann, fib, tarai, tak,
177+rbtree) YJIT gives a real 4-6x lift, but Spinel still wins by ahead-
178+of-time specialization. `json_parse` is the one win for YJIT: its
179+inner loop is dominated by `String` method dispatch that YJIT inlines
180+well, and Spinel's polymorphic-receiver path costs about 7% extra.
171181
172182 ## Supported Ruby Features
173183