From: "Shot (Piotr Szotkowski)" Date: 2007-02-01T00:26:31+09:00 Subject: Re: Benchmark results --y1+kC1Q2udlVMFpc Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Pit Capitain: > The advantage of Mauricio's solution is that you can use it even if > the Set elements are not comparable to each other. My proposal was > meant for your use case with integers as Set elements. Ah, right. Still, blocks will contain integers only, so Array#sort-based Block#hash and Set#=3D=3D-based Block#eql? should suffice. > With this benchmark, you also measure the time needed to construct > the Block instances. If you want to compare the two #hash methods, > you should change your benchmark to something like: D=E2=80=99oh! Why did I think moving the array creation out was the most I can get to unbias the benchmark? > From your benchmark, you can see that it takes a lot of time to > compute the hash values. Will your sets contain 1_000_000 elements? > How often will they change? How are they created? Maybe you need to > cache the hash values or implement a different hash algorithm. I don=E2=80=99t know, yet. I was just curious whether the elements=E2=80=99= -hash-based hash algorithm would be any faster than the just-sort-based one (given that from a quick glance it seemed to incorporate additional work); now I understand its advantage lies elsewhere. Thanks a lot for your input! -- Shot --=20 In ObjectSpace, nobody can hear you quack. -- Luc Heinrich, ruby-talk --y1+kC1Q2udlVMFpc Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.2 (GNU/Linux) iD8DBQFFwLVDi/mCfdEo8UoRAsuVAKDMVd+6RmEPSHHQsCOrXXqBakE20wCfXvB1 JLXtquzRt2fRlEkJqjWMIOI= =e9W6 -----END PGP SIGNATURE----- --y1+kC1Q2udlVMFpc--