On 12:05 Sun 06 Feb , Michael Gebhart wrote: > Hi, > > because of my interest in mono and ruby I have done a small benchmark. > These are the results: > > Mono Code: > > using System; > > class Bench { > public static void Main() { > double d = 0; > > for (int i = 0; i < 1000000000; i++) { > d = d + i; > } > > Console.WriteLine(d); > } > > Needs 10.8 Seconds. > > > In Ruby: > > d=0 > 1000000000.times { > d = d + 1 > } > > puts d > > > Needs: 8 minutes and 20 seconds. > > > Does not look very good :( Is there a possibility to tune my ruby-program, > to be as fast as mono? At the risk of sounding defensive... My first question when seeing benchmarks like this: how many real-world programs have, as their performance bottleneck, a massive loop that just increments numbers? I'm sure there are some--I don't deny it--but is your application one of them? If you want to compare performance between two programming languages and execution environments, the first rule is to find a benchmark that properly measures the performance of those languages in the correct domain. Figure out what you want those languages to do, for real, and write a simple test that does that thing. Then run your test. Second rule: figure out what to measure. Is execution time the only important factor? Or is memory consumption an issue as well? Network traffic? Development time? Maintenence effort? Portability? Etc. If execution time and memory consumption are both the most important, you'd do well to abandon both Ruby and Mono and code in C. Or assembly code. You can *always* find a situation in which language X will "outperform" language Y (for some definition of "outperform"). There are things that Ruby does better than Mono, I'm sure (but not being familiar with Mono, I'm not qualified to say what they might be). Although, at a glance, it looks like the Mono sample took twice as many lines of code as the Ruby sample... Just some things to think about. Certainly continue your investigations--please don't think I'm discouraging that--but make sure you are testing the right things, and comparing the right metrics. - Jamis -- Jamis Buck jamis_buck / byu.edu http://jamis.jamisbuck.org ------------------------------ "I am Victor of Borge. You will be assimil-nine-ed."