summaryrefslogtreecommitdiff
path: root/benchmark/attr_accessor.yml
blob: 82134cdf9b4c053a5f45cdfce561675672714156 (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
prelude: |
  class C
    attr_accessor :x
    def initialize
      @x = nil
    end
    class_eval <<-END
      def ar
        #{'x;'*256}
      end
      def aw
        #{'self.x = nil;'*256}
      end
      def arm
        m = method(:x)
        #{'m.call;'*256}
      end
      def awm
        m = method(:x=)
        #{'m.call(nil);'*256}
      end
    END
  end
  obj = C.new
benchmark:
  attr_reader: "obj.ar"
  attr_writer: "obj.aw"
  attr_reader_method: "obj.arm"
  attr_writer_method: "obj.awm"