repo.or.cz
/
ruby.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
[rubygems/rubygems] Use a constant empty tar header to avoid extra allocations
[ruby.git]
/
benchmark
/
attr_accessor.yml
blob
82134cdf9b4c053a5f45cdfce561675672714156
1
prelude: |
2
class C
3
attr_accessor :x
4
def initialize
5
@x = nil
6
end
7
class_eval <<-END
8
def ar
9
#{'x;'*256}
10
end
11
def aw
12
#{'self.x = nil;'*256}
13
end
14
def arm
15
m = method(:x)
16
#{'m.call;'*256}
17
end
18
def awm
19
m = method(:x=)
20
#{'m.call(nil);'*256}
21
end
22
END
23
end
24
obj = C.new
25
benchmark:
26
attr_reader: "obj.ar"
27
attr_writer: "obj.aw"
28
attr_reader_method: "obj.arm"
29
attr_writer_method: "obj.awm"