Commit 4e2092a7
4e2092a74656Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 8 months ago · 2 files · +2 added
Description
Port structaref/structaset benchmarks
Both Struct getter/setter benchmarks work out of the box. structaref: Spinel <0.01s vs CRuby 0.21s (>21x) structaset: Spinel <0.01s vs CRuby (similar) 79/79 tests pass.
Co-Authored-By: Claude Opus 4.6 (1M context) [email protected]
Details
- Commit
- 4e2092a74656
- Parent
- 8f49d73a7e78
examples/bm_structaref.rbaddedView file
1+
# structaref benchmark (from yjit-bench)2+
TheClass = Struct.new(:v0, :v1, :v2, :levar)3+
4+
def get_value_loop(obj)5+
sum = 06+
i = 07+
while i < 10000008+
sum = sum + obj.levar9+
sum = sum + obj.levar10+
sum = sum + obj.levar11+
sum = sum + obj.levar12+
sum = sum + obj.levar13+
sum = sum + obj.levar14+
sum = sum + obj.levar15+
sum = sum + obj.levar16+
sum = sum + obj.levar17+
sum = sum + obj.levar18+
i = i + 119+
end20+
sum21+
end22+
23+
obj = TheClass.new(1, 2, 3, 1)24+
puts get_value_loop(obj)25+
puts "done"examples/bm_structaset.rbaddedView file
Loading diff…