From: Stefan Matthias Aust Date: 2001-05-06T03:41:23+09:00 Subject: [ruby-talk:14717] Re: Why's Ruby so slow in this case? "David S." wrote: >It seems to me that your code is spending most of its time in the >range loops. Unfortunately, this doesn't have any measurable effect. But I've to do an awkward update on my earlier posting: I suffered from a "Heisenbug", I didn't notice that the profiler was responsible for the slowness it measured. It at least adds a factor of 10..100 to the total execution time! So I used a different method to time my application. To get a better impression of the real execution time, I used first time ruby -w -e '100000.times{}' to measure the constant overhead for initializing the interpreter and looping through the test loop and then run time ruby -w -e '$m=35;def o(x,y)x>=0 && x<$m && y>=0 \ && y<$m end; 100000.times{o(4,4)}' and got an execution time of about 0.9s to 1s for this command. This means, Squeak is only 7-8 times faster than Ruby for this test case. Running the game for a 15x15 map and measuring the time with the method described above takes 6.3s regardless whether I use a "for 0..5" or a "d=0; while d < 6" loop construct. bye -- Stefan Matthias Aust \/ Truth Until Paradox