summaryrefslogtreecommitdiff
path: root/benchmark/vm_ivar_set_on_instance.yml
blob: 91857b7742e0f26b2fe7e89c41de0e205c7a2f2a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
prelude: |
  class TheClass
    def initialize
      @v0 = 1
      @v1 = 2
      @v3 = 3
      @levar = 1
    end

    def set_value_loop
      # 1M
      i = 0
      while i < 1000000
        # 10 times to de-emphasize loop overhead
        @levar = i
        @levar = i
        @levar = i
        @levar = i
        @levar = i
        @levar = i
        @levar = i
        @levar = i
        @levar = i
        @levar = i
        i += 1
      end
    end
  end

  obj = TheClass.new

benchmark:
  vm_ivar_set_on_instance: |
    obj.set_value_loop
loop_count: 100