From: "Thomas Gagné" Date: 2002-11-22T15:57:08+09:00 Subject: Re: Ruby is too slow MetalOne wrote: > Thomas Gagn� wrote in message news:<3DDCFB97.1040505@wide-open-west.com>... > >>Do I have the Smalltalk version right? >> >>size := 640*480*2. >>image := ByteArray new: size withAll: 0. >>lookup := ByteArray new: size withAll: 0. >> >>Time millisecondsToRun: [ >> 1 to: size do: [ :i | >> image at: i put: (lookup at: (image at: i ) + 1) >> ] >>] >> >>"159" > > > > I don't know smalltalk, but it looks close enough. > I don't see the reason for the + 1. Smalltalk numbers its indexes from 1 instead of 0. Since the value of "image at: i" was zero I added 1 to it. > The lookup table was actually only 1024 elements, but it doesn't really matter. > What kind of processor did you run the test on. My Dell 5000's 650--it was plugged in and I had the dimmer switch on all the way :-). -- ..tom remove dashes in email for replies http://isectd.sourceforge.net