Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support tracing of struct member accessor methods
This follows the same approach used for attr_reader/attr_writer in 2d98593, skipping the checking for tracing after the first call using the call cache, and clearing the call cache when tracing is turned on/off. Fixes [Bug #18886]
- Loading branch information
1 parent
1721bb9
commit 3081c83
Showing
5 changed files
with
118 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
prelude: | | ||
C = Struct.new(:x) do | ||
class_eval <<-END | ||
def r | ||
#{'x;'*256} | ||
end | ||
def w | ||
#{'self.x = nil;'*256} | ||
end | ||
def rm | ||
m = method(:x) | ||
#{'m.call;'*256} | ||
end | ||
def wm | ||
m = method(:x=) | ||
#{'m.call(nil);'*256} | ||
end | ||
END | ||
end | ||
obj = C.new(nil) | ||
benchmark: | ||
member_reader: "obj.r" | ||
member_writer: "obj.w" | ||
member_reader_method: "obj.rm" | ||
member_writer_method: "obj.wm" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters