From: Randall Alexander Date: 2009-03-05T03:58:57+09:00 Subject: Re: Compiling a Ruby app --0016363b8824d1d25004644fa973 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit The Spring Framework uses a lot of reflection yet many would not call it trivial. We use reflection in our enterprise because it is the best way to solve a problem. As far as it being slow there are a lot of cavities to that. It being slow used to be the case but the blanket statement of all is not true. The reason why it was always slow is because instead of the compiler do a lot of the work the interpreter has to do the compilers work now in addition to what it already had to do with a precompiled class. If your runtime engine does look aheads (which many modern ones do) then the interpreter can have the class evaluated and loaded before it is ever used. One of the factors of that working is the size of the class and everything the class needs. We ran a few tests for our enterprise and determined that if the class was not a heavy weight class then there was no real performance penalty (i.e. response time). Ironically it actually speed things up over the code that needed to do the same thing, in a non "reflection" based algorithm. There are a number of other reasons why an application can be trivial or slow, but it does not necessarily mean it is because of reflection. On Wed, Mar 4, 2009 at 11:36 AM, Kyle Schmitt wrote: > On Wed, Mar 4, 2009 at 6:21 AM, David Masover wrote: > > No. But there are technical reasons it's hard to create one. > > > > The biggest one is reflection: > > > > eval 'class Fixnum; def +(other); 42; end; end' > > > > Imagine the backflips a compiler would have to do in order to allow the > > above to work. You'd have no choice but to include the entire compiler > with > > your program. > > > Heh. Just try and use software that relies heavily on reflection in a > compiled language. Supposedly .Net has reflection nativeley, but the > applications I've used that take advantage of it were horribly slow > and or unreliable. From what I've seen the compiled applications out > there that use reflection are either trivial, or slow. > > --Kyle > > -- Randy http://randallalexander-os.blogspot.com/ http://randallalexander-java.blogspot.com/ http://randallalexander-flex.blogspot.com/ --0016363b8824d1d25004644fa973--