From: Premshree Pillai Date: 2005-01-24T18:27:59+09:00 Subject: Re: looking at ruby... On Mon, 24 Jan 2005 16:16:47 +0900, Paris Sinclair wrote: > On Mon, 24 Jan 2005, Premshree Pillai wrote: > > >>> You can find some standard benchmarks at http://shootout.alioth.debian.org/ > >> > >> the requirements are that each language implement the sollution exactly the > >> same as some other language implementation that was already done. > > > > Umm, what makes you think the implementations are done differently for > > different languages? They use a standard algorithm -- for obvious > > reasons -- across all the languages. > > Yes, normally when you are benchmarking and comparing language, you start with > a problem and what the end result of the solution should be. And then of course > the exact implementation in each language will be appropriate to that language. > For example, sorting in C often looks very different from sorting in Perl. THe > lowest common denominator will be C-ish. And Ruby's ranges are another example. > In these benchmarks, the format forces the Ruby code to look like C. > for i in 0 .. (rows - 1) > instead of > (0...rows).each { |i| ... } Ah, there you have a point. That's a serious flaw then. Methinks the program should just follow the high-level algorithms, and then be implemented in the particular language using whatever data structure/controls are optimized for that language. > I don't know in this case if there is a difference in performance. I a nuby. > BUt I know that in Perl, the Perl-ish constructs are the ones best optimized. > If you structure your code the same as a Java app, it will go sloooow. Even at > tasks like sorting, where the opposite is usually true in real life. You > wouldn't hand-code a quicksort, because the included one is lightning speed. > > -- > RubyPanther > > -- Premshree Pillai http://www.livejournal.com/~premshree