Ruby
| Unit | a file or a folder of module functions |
| Bridge | a magnus extension under the original modules |
| Recorded and replayed by | a generated Ruby driver |
| Needs | Ruby 3+ |
| Status | Verified on shellwords.rb from Ruby 3.3: 1,617/1,617 (446 raise), gate passes |
Types come from YARD tags; untyped parameters used as numbers are inferred as numbers. Batches are Mod::FnBatch.new(items), and batch items can be any value.
What a port has to get right
downcaselowers each character alone, without Rust's final-sigma rule.Array#sumuses Kahan-Babuska summation and starts from integer 0, so[-0.0].sumis0.0.Float#to_suses exponent form from 1e15 up (1e15.to_sis1.0e+15,1e14.to_sis100000000000000.0);nil.inspectinside arrays isnil.- Dynamic typing costs code: the
shellwordsport reimplements Ruby'sto_sandinspectfor numbers, nil, arrays and hashes, becauseshellescapeaccepts anything.
Speed
The interpreter is slow enough that even small functions win. On shellwords, bench measured the port 4.4x faster than Ruby per call (3.6-7x per function). As batches on 4 cores: Shellwords.shellescape over 50,000 mixed values (88 ms in Ruby) ran 11.8x faster, and slugify over 20,000 strings (110 ms) 12.7x.
Details: Six languages.