From: Martin Jansson Date: 2005-09-12T02:41:32+09:00 Subject: Re: Better Random benchmark - need help with profiling You convinced me. I will make a nice looking version. It will still be faster then the originally submited code. Beating PHP and TCL isn't worth it, because it will still be much slower then Python ;-). The code should prove where Rubys strength is. martinjansson$ ruby "random_benchmark.rb" 10 900000 user system total real Original 0.000000 0.020000 132.660000 (134.971980) Rubiesque 0.000000 0.010000 96.310000 ( 97.665882) Ugly 0.000000 0.010000 90.470000 ( 92.571550) As for a better benchmarking tool. It might be a good next project for me. It shouldn't be that hard to take an array with pairs of textstrings and lambdas. Iterate over the array. time the lambdas. Iterate a couple of more times. Sum up the used time for each lambda and make a nice presentation. On Sun, 11 Sep 2005 10:07:54 +0200, Brian Schr�der wrote: > On 11/09/05, Martin Jansson wrote: >> On Sat, 10 Sep 2005 21:34:44 +0200, Brian Schr�der >> >> [snip] >> >> Shroeder! What version of Ruby do you use? >> > > $ ruby -v > ruby 1.8.3 (2005-06-23) [i486-linux] > > >> I did something similar in one of my many versions. And it is the oo >> thing >> to do. >> (I haven't actually benchmarked puts vs printf, I will do that ;) >> >> It's not faster on my system. That may be proof that profiling is a bad >> thing and that we all should prove our code mathematically (shudder). > > If you look at the benchmark I provided, it is a bit slower on my > system too. But it is a lot prettier IMHO. I just tried rewriting the > thing in nice ruby, because thats what ruby is for. Otherwise just > write a c extension and do > > require 'random.so" > or even better just use the builtin mersenne twister (Kernel#rand) > > > >> [snip] >> >> I have a lot of white noise on my system, so I haven't used Rubys >> benchmark thingie much. It would be more useful to me if it could do >> matched pair sampling (is that the correct English term?) and/or throw >> away extreme values. >> > > If the noise is really white, you just need to sample often enough. It > will average out. > > hope to help, > > Brian >