# Code Review: RubyReflectionCache

**URL:** <https://www.ruby-forum.com/t/code-review-rubyreflectioncache/150947>\
**Category:** IronRuby\
**Created:** [October 15, 2008, 5:08am UTC](https://www.ruby-forum.com/t/code-review-rubyreflectioncache/150947 "2008-10-15T05:08:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![grujildo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/94ad74/32.png) [@grujildo](https://www.ruby-forum.com/u/grujildo)\
**Post date:** [October 15, 2008, 5:08am UTC](https://www.ruby-forum.com/t/code-review-rubyreflectioncache/150947/1 "2008-10-15T05:08:11Z")

</div>

tfpt review “/shelveset:RubyReflectionCache;REDMOND\tomat”

Implements profiling of Ruby methods: Given -profile on command line  
the compiler instruments each Ruby method by code that captures the  
current timestamp (in ticks) in method prologue and updates a global  
variable associated with the method in its epilogue. At the end, it  
dumps all values into “profile.log” file.

Implements reflection cache: a static class Methods that contains  
properties for each method that is emitted into IL. The properties  
return MethodInfo for the method and cache it. The properties are  
generated for methods in RubyOps marked by [Emitted] attribute. The  
generator (“ClassInitGenerator”) now refers to internal classes so it  
needs to be signed and a friend assembly of IronRuby.dll

Adds alias “gencache” that generates ReflectionCache.Generated.cs  
file.

Tomas

---

<div class="post-metadata">

**Author:** ![grujildo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/94ad74/32.png) [@grujildo](https://www.ruby-forum.com/u/grujildo)\
**Post date:** [October 15, 2008, 5:52am UTC](https://www.ruby-forum.com/t/code-review-rubyreflectioncache/150947/2 "2008-10-15T05:52:02Z")

</div>

Nice! Looks good.

---

<div class="post-metadata">

**Author:** ![grujildo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/94ad74/32.png) [@grujildo](https://www.ruby-forum.com/u/grujildo)\
**Post date:** [October 15, 2008, 8:09am UTC](https://www.ruby-forum.com/t/code-review-rubyreflectioncache/150947/3 "2008-10-15T08:09:30Z")

</div>

We have recently implemented the last feature that prevented irb from  
running, so here it is:

C:\M1\Merlin\External\Languages\Ruby\ruby-1.8.6\bin\>rbr -X:Interpret irb  
irb(main):001:0\> 1+1  
=\> 2  
irb(main):002:0\> puts \<\<end  
irb(main):003:0" hello world  
irb(main):004:0" end  
hello world  
=\> nil  
irb(main):005:0\> require ‘mscorlib’  
=\> true  
irb(main):006:0\> include System::Collections::Generic  
=\> Object  
irb(main):007:0\> l = List[Fixnum].new  
=\> []  
irb(main):008:0\> l.add 1  
=\> nil  
irb(main):009:0\> l.add 2  
=\> nil  
irb(main):010:0\> l.add 3  
=\> nil  
irb(main):011:0\> l  
=\> [1, 2, 3]  
irb(main):012:0\> l.each\_with\_index { |x,i| puts “#{i} -\> #{x}” }  
0 -\> 1  
1 -\> 2  
2 -\> 3  
=\> [1, 2, 3]  
irb(main):013:0\> exit

Tomas
