From: Christoph Date: 2002-03-20T11:01:34+09:00 Subject: Re: Why is Ruby so slow? - Solution "Venherm Borchers" wrote in .... > 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! This depends. If you ``set subtract'' a one million element set from an other one million element set then the current Array#- implementation will be unbelievably fast. Your problem is probably the picture perfect example that the price tag for the convenience of ``mixin in'' the functionality of a HashSet class into a list like Array class are the occasional severe performance penalties - this kind thing would have never happened if you had been forced to write out the ``hidden type conversions'' explicitly. /Christoph