From: "Shot (Piotr Szotkowski)" Date: 2008-10-20T08:08:02+09:00 Subject: Re: newbie q: stripping duplicates --i9LlY+UWpKt15+FH Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Marcin Miel=C5=BCy=C5=84ski: > 1.8.7 and 1.9.x use deep hashing for hashes, to achieve that in > 1.8.6 you need to monkey patch Hash: http://pastie.org/pastes/272194 Right, and I use =E2=80=98alias eql? =3D=3D=E2=80=99 and hand-crafted hash = methods in most of my classes that need to be sane Set elements. I understand the idea behind the hash method (let=E2=80=99s have a quick way to check whether two objects are different =E2=80=93 and look closely with = eql? only if their hashes are the same), but I wonder whether there are any rules-of-thumb for finding the sweet spot between making it fast and making it return different results for different objects often. For example, is 137 in the above pastie snippet a =E2=80=98magic number=E2= =80=99 that it=E2=80=99s good to multiply by? I understand how the bitwise XORs make ev= ery key and value impact the hash, but why not also multiply by 137 between the key+value iterations? -- Shot --=20 Man will never be free until the last king is strangled with the entrails of the last priest. -- Denis Diderot --i9LlY+UWpKt15+FH Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.2 (GNU/Linux) iD8DBQFI+7+Pi/mCfdEo8UoRAtL+AKCaHPWYIqu7ekKKg9Slrturz/lMFACeOfuJ D1IXivMBx6pS4KpZcLtO7vQ= =YfvK -----END PGP SIGNATURE----- --i9LlY+UWpKt15+FH--