From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 0D26B7F75C for ; Wed, 10 Sep 2014 14:44:29 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of info@gerd-stolpmann.de) identity=pra; client-ip=212.227.17.10; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="info@gerd-stolpmann.de"; x-sender="info@gerd-stolpmann.de"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of info@gerd-stolpmann.de) identity=mailfrom; client-ip=212.227.17.10; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="info@gerd-stolpmann.de"; x-sender="info@gerd-stolpmann.de"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mout.kundenserver.de) identity=helo; client-ip=212.227.17.10; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="info@gerd-stolpmann.de"; x-sender="postmaster@mout.kundenserver.de"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AuIBAPdGEFTU4xEKm2dsb2JhbABZg2BXyjOHUAGBDhYQAQEBAQEGCwsJFCqEBAEFVSQQCw4KLlcGEwmIPQmqMJM0AReJZIVDJgeETAWGGotgiGyJSQWPVhyBXmoBgk4BAQE X-IPAS-Result: AuIBAPdGEFTU4xEKm2dsb2JhbABZg2BXyjOHUAGBDhYQAQEBAQEGCwsJFCqEBAEFVSQQCw4KLlcGEwmIPQmqMJM0AReJZIVDJgeETAWGGotgiGyJSQWPVhyBXmoBgk4BAQE X-IronPort-AV: E=Sophos;i="5.04,499,1406584800"; d="asc'?scan'208";a="93954014" Received: from mout.kundenserver.de ([212.227.17.10]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 10 Sep 2014 14:44:28 +0200 Received: from office1.lan.sumadev.de (dslb-088-068-067-138.088.068.pools.vodafone-ip.de [88.68.67.138]) by mrelayeu.kundenserver.de (node=mreue105) with ESMTP (Nemesis) id 0MabPt-1Xli302jyT-00K9tL; Wed, 10 Sep 2014 14:44:27 +0200 Received: from [192.168.5.106] (dslb-088-068-067-138.088.068.pools.vodafone-ip.de [88.68.67.138]) by office1.lan.sumadev.de (Postfix) with ESMTPSA id 13166DC270; Wed, 10 Sep 2014 14:44:27 +0200 (CEST) Message-ID: <1410353062.3003.23.camel@thinkpad> From: Gerd Stolpmann To: Nick Lucaroni Cc: Ocaml Mailing List Date: Wed, 10 Sep 2014 14:44:22 +0200 In-Reply-To: References: <54101221.3010304@users.sourceforge.net> <1410348425.3003.11.camel@thinkpad> <1410351988.3003.19.camel@thinkpad> Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-B2tbm2K8Zm3et9zGwClq" X-Mailer: Evolution 3.10.4-0ubuntu2 Mime-Version: 1.0 X-Provags-ID: V02:K0:UKZTOzUnUJGVH0tnhWVokJVPuz/pKZzIhgPVFR2639R luBjWuoRC82nYMnIIjy0ahqJEB9HZqXdRlRzDtLRa4cMed8SFp JRf/0YdZ+YRcqBE13OHO0EaqKM1quOU16SgEbm7xcdUZUJIR8v TnK5TaW7YNJ9DftF2Xj13HVwL9w8myPnWqJEqJUwagL3hB4Xm2 0nP64uqKvvQiw2dSZsExCfwIMyKJEA2FDMPNG/ul1/gHc4mWeR /o/qnR4mExFc1jKbxH8q9vxNo+fvpCSyskbThguP5K9sHbRcGe lre21GwvZ3ge4ojYUq0SVHAHnTPRcaKZnn2o7SzPekYy1fdoJE KRl3+vVeeI5QGOHEPR9z7TviBtx3Q3OqJx58qj/XO X-UI-Out-Filterresults: notjunk:1; Subject: Re: [Caml-list] Clarification for the configuration of comparison functions --=-B2tbm2K8Zm3et9zGwClq Content-Type: text/plain; charset="ISO-8859-15" Content-Transfer-Encoding: quoted-printable Am Mittwoch, den 10.09.2014, 08:40 -0400 schrieb Nick Lucaroni > On Sep 10, 2014 8:27 AM, "Gerd Stolpmann" > wrote: > > There is something else that can speed up a custom compare: you can > also > > store a hash of the value inside the value, and use that for > speeding up > > comparison, e.g. > > > > type t =3D ... > > type t_cmp =3D t * int > > > > let wrap x =3D (x, Hashtbl.hash x) > > > > let my_compare (x1,h1) (x2,h2) =3D > > if h1=3Dh2 then > > compare x1 x2 > > else > > h1-h2 >=20 > The hash difference here would cause issues, is it really worth it if > you have to recover some ordering anyway? I can see the value in > defining equality, though. For example, if you need the ordering only for a Map or Set, it doesn't matter how things are ordered. Gerd --=20 ------------------------------------------------------------ Gerd Stolpmann, Darmstadt, Germany gerd@gerd-stolpmann.de My OCaml site: http://www.camlcity.org Contact details: http://www.camlcity.org/contact.html Company homepage: http://www.gerd-stolpmann.de ------------------------------------------------------------ --=-B2tbm2K8Zm3et9zGwClq Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAABAgAGBQJUEEemAAoJEAaM4b9ZLB5TreUH/1LvxZ/YJEX7bkg6WulmdirH r0YmEJ8PoYv3TbGIdb1QAYcV2IgfU+XOUHHV+dYNH46pQbooP1YhMaQ3qNgePCtu r/KPJne2pu3+fzKPWovwyQRTw/Eenpa4XnPycpoI5khWnrBxjF7h/c4Gqfpz4Wuv Ya2nXABxHKZ/LRKz4NUyWmmO2u/6LJclNUVNaKiI4hh7rnkfob6wf4tfGtHK3OZE fZ7EerRIZ4fNVLRfoBKUAPpBy9UP664YBO+C6WkqFepgYYHvEQhrIFFHjNXKzWiX jGVJv0+aoGxNMLyCZi8l3lXrW3zXlvZ7YDwVMe77OR2eIGQliiGh5BA0T3XgZMA= =6AyA -----END PGP SIGNATURE----- --=-B2tbm2K8Zm3et9zGwClq--