1 parent a5d4ae8 commit 951cc3dCopy full SHA for 951cc3d
2 files changed
benchmarks.yml
@@ -256,6 +256,10 @@ str_concat:
256
category: micro
257
single_file: true
258
ractor: true
259
+struct-new-no-escape:
260
+ desc: instantiate new struct objects with fields in a loop to test allocation and escape analysis performance
261
+ category: micro
262
+ single_file: true
263
structaref:
264
desc: structaref tests the performance of getting Struct members
265
benchmarks/struct-new-no-escape.rb
@@ -0,0 +1,16 @@
1
+require_relative '../harness/loader'
2
+
3
+Point = Struct.new(:x, :y)
4
5
+def test
6
+ p = Point.new(1, 2)
7
+ p.x + p.y
8
+end
9
10
+run_benchmark(100) do
11
+ i = 0
12
+ while i < 1_000_000
13
+ test
14
+ i += 1
15
+ end
16
0 commit comments