From: Eugene Ventimiglia Date: 2001-02-23T07:04:01+09:00 Subject: [ruby-talk:11351] Re: Array bugs? > > A similar problem is for loopless graphs. Try the following: > > def f(x); [x,x]; end > def g(x); f f f f f f f f x; end > (g g g 1) == (g g g 1) #=> true > > This seems normal, but it takes 33 million comparisons, even though each > side of the equality has only 25 objects !!! Forgive me if I'm misreading this, but doesn't g(x) produce 512 objects? irb(main):001:0> def f(x); [x,x]; end nil irb(main):002:0> f 1 [1, 1] irb(main):003:0> f f 1 [[1, 1], [1, 1]] irb(main):004:0> That would make g g g 1 produce 512 * 512 * 512 objects, roughly 135 million