From: "Peña, Botp" Date: 2002-03-20T11:03:10+09:00 Subject: RE: Why is Ruby so slow? - Solution yes, and I'd like to know, too, how did Nobu knew that that line was the culprit... btw, you guys are cool... Thanks, -botp > -----Original Message----- > From: Jim Freeze [mailto:jim@freeze.org] > Sent: Wednesday, March 20, 2002 5:26 AM > To: ruby-talk@ruby-lang.org > Subject: Re: Why is Ruby so slow? - Solution > > > On Wed, Mar 20, 2002 at 05:26:27AM +0900, Venherm Borchers wrote: > > Dear colleagues, > > > > The solution > > ------------ > > > > Nobu Nakada pointed out that the following line might be causing the > > problem, and it indeed does: > > > > nitms = (@col[j]-['']).nitems > > > > Here I relied on the 'set difference' that returns an array of only > > unique elements which then are counted. I have to warn you: > this kind > > of set operation is _unbelievably_ slow! > > > How did you implement @col[j]-[''] to get a speed improvement? > > > -- > Jim Freeze > atto: 1e-18 = one quintillionth > parsec: 3.258 light-years: 3.258 * 186000 * 364 * 24 * > 3600 * 5280 * 12 > attoparsec: atto * parsec =~ 1.20 inch > My height: 62 inches / 1.2 = 51.7 attoparsecs > ~ >