From: Vidar Hokstad Date: 2008-05-12T22:35:02+09:00 Subject: Re: Huge performance gap On May 12, 7:54 am, Roger Pack wrote: > Bill Kelly wrote: > > But yes, it's harder to make a language like Ruby, which is highly > > dynamic at runtime, fast like C++ and Java, which are primarily > > statically compiled.  The Smalltalk folks have reportedly done pretty > > well though, so there exists the possiblilty that Ruby may get > > substantially faster in the future.  YARV is already making some > > headway. > > My question is what does 1.9 exactly do with its "Inline (Method) > cache"[1]?  Is there room for more improvement with a better JIT > compiler?  How much would this help scripts? There's a huge amount of room for improvement in the still. I haven't seen any of the Ruby implementations even try to apply more sophisticated VM/JIT techniques such as tracing and polymorphic inline caches properly. There's nothing inherently in Ruby preventing "near C" performance (at least within the same magnitude, but probably a lot closer), though there are lots of things that make it a lot of work to get there (the level of dynamism, certainly). Even thought Ruby programs in theory are extremely dynamic, most paths through a program will be heavily dominated by the same types over and over, and that can be exploited to massively reduce overhead, with some pretty cheap checks to shunt execution over to a fallback if certain assumptions don't hold etc. It's a question of when, not if, we see far faster Ruby implementations than the current range of VMs. Vidar