From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id NAA19609; Mon, 2 Aug 2004 13:05:52 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id NAA29324 for ; Mon, 2 Aug 2004 13:05:51 +0200 (MET DST) Received: from oola.is.scarlet.be (oola.is.scarlet.be [193.74.71.23]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i72B5oEV027706 for ; Mon, 2 Aug 2004 13:05:50 +0200 Received: from (u212-239-128-56.dialup.planetinternet.be [212.239.128.56]) by oola.is.scarlet.be with ESMTP id i72B5kY31741; Mon, 2 Aug 2004 13:05:46 +0200 Received: from poincare ([127.0.0.1] helo=localhost ident=trch) by poincare with esmtp (Exim 3.36 #1 (Debian)) id 1BrZSt-0000V8-00; Mon, 02 Aug 2004 11:50:43 +0200 Date: Mon, 02 Aug 2004 11:50:40 +0200 (CEST) Message-Id: <20040802.115040.130527572.debian00@tiscali.be> To: matth@cs.berkeley.edu Cc: caml-list@inria.fr Subject: Re: [Caml-list] equality testing in 3.08 From: Christophe TROESTLER In-Reply-To: <200408020151.i721pCLL012876@relay0.EECS.Berkeley.EDU> References: <200408020151.i721pCLL012876@relay0.EECS.Berkeley.EDU> Organization: None X-Spook: terrorist lock picking broadside clones CDC Juiliett Class Submarine monarchist Europol USCODE Rand Corporation X-Blessing: Om Ah Hum Vajra Guru Pema Siddhi Hum X-Operating-System: GNU/Linux (http://www.linux.org/) X-Mailer-URL: http://www.mew.org/ X-Mailer: Mew version 4.0.65 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 410E200E.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 troestler:01 tiscali:99 slower:01 cyclic:01 cyclic:01 chris:01 christophe:01 equality:01 equality:01 int:01 checking:01 comparison:02 comparison:02 explicit:03 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Sun, 1 Aug 2004, "Matt Harren" wrote: > > 1) Our application runs 9% slower because comparison isn't as > efficient. When x == y, checking "x = y" takes time proportional to > the size of the structure, instead of constant time. I do not know what you are comparing but maybe a custom comparison function would make things even faster? As an example, min : 'a -> 'a -> 'a and let min' x y = if (x:int) < y then x else y have (very) different speed characteristics! > 2) We've been cheating and using (=) on structures that may be cyclic. Same: why don't you define the meaningful equality? Sure, you do not have the convenience of the name "=" but you can use "===", "=^=", "=~=",... This probably would also make your software easier to understand (the "strange" comparison on cyclic structures would be made explicit). Regards, ChriS ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners