Commit f6b35d44

f6b35d4407fbMerged

Yukihiro "Matz" Matsumoto <[email protected]> · 8 months ago · 1 file · +1 added

Description

Port send_bmethod: replace define_method with def

define_method with static block body is equivalent to def for AOT. Spinel <0.01s vs CRuby 0.22s (>22x) 83/83 tests pass.

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

Details

Commit
f6b35d4407fb
Parent
52672ded9c57

examples/bm_send_bmethod.rbaddedView file

1+# send_bmethod benchmark (from yjit-bench)
2+# define_method replaced with def (equivalent for AOT)
3+
4+def zero
5+ 0
6+end
7+
8+def one(arg)
9+ arg
10+end
11+
12+total = 0
13+n = 0
14+while n < 500000
15+ zero
16+ total = total + one(123)
17+ zero
18+ total = total + one(123)
19+ zero
20+ total = total + one(123)
21+ zero
22+ total = total + one(123)
23+ zero
24+ total = total + one(123)
25+ zero
26+ total = total + one(123)
27+ zero
28+ total = total + one(123)
29+ zero
30+ total = total + one(123)
31+ zero
32+ total = total + one(123)
33+ n = n + 1
34+end
35+puts total
36+puts "done"