Commit a0a0c7dc

a0a0c7dc42d7Merged

Yukihiro "Matz" Matsumoto <[email protected]> · 8 months ago · 8 files · +7 added · ~1 modified

Description

Port 7 Ruby core benchmarks, fix Float literal/pow codegen

Fixes:

  • Float literal 2.0 now outputs "2.0" not "2" (%.17g → ensure dot)
  • Float#** → pow(), Float#to_i, Float#to_f added

New benchmarks from ruby/benchmark:

  • spectralnorm: Spinel 0.01s vs CRuby 1.05s (105x)
  • tarai: 0.01s vs 0.43s (43x)
  • ackermann: <0.01s vs 0.40s (>40x)
  • nested_loop: <0.01s vs 0.34s (>34x)
  • tak: 0.02s vs 0.50s (25x)
  • partial_sums: 0.08s vs 1.28s (16x)
  • sieve: 0.04s vs 0.44s (11x)

89/89 tests pass.

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

Details

Commit
a0a0c7dc42d7
Parent
008d6b768b29

examples/bm_ackermann.rbaddedView file

1+def ack(m, n)
2+ if m == 0
3+ n + 1
4+ elsif n == 0
5+ ack(m - 1, 1)
6+ else
7+ ack(m - 1, ack(m, n - 1))
8+ end
9+end
10+
11+puts ack(3, 9)
12+puts "done"