From: "Marcin Mielżyński" Date: 2006-02-24T08:08:32+09:00 Subject: Re: Huge performance gap Alexis Reigel wrote: > Stephen Waits wrote: >> E. Saynatkari wrote: >> >>> Post the code somewhere, there might be room for improvement >>> in the algorithm though it will still be considerably slower. >> >> It looks, to me, like he attached his code to the OP. >> >> Regardless, it doesn't matter. Algorithmic improvements may help both >> the C++ and Ruby versions - but it's not going to change the fact that >> one is a relatively low-level language, compiled to native machine code, >> and the other is an interpreted dynamic language. To compare them is >> either ridiculous, or more likely in this case, simply ignorant. >> >> --Steve >> > Why should that be ridiculous or ignorant? > I stated that I was aware of the differences between interpreted and > compiled languages. But that does not change the fact that I believe > that this does not explain the performance gap. An execution time of > 27.65 seconds against 0.33 seconds is not just nothing is it? It's a > factor of over 80 times. Besides, I implemented the same code in java > too, which isn't native code as well and runs in a virtual machine too, > and it executed in about the same time as c++. > > Which version of java did you use ? Since 1.4 there is a JIT compiler so java _IS_ compiled into native code unless you disable it explicitly. lopex