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 DAA10997; Mon, 2 Aug 2004 03:51:16 +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 DAA11580 for ; Mon, 2 Aug 2004 03:51:15 +0200 (MET DST) Received: from relay0.EECS.Berkeley.EDU (relay0.EECS.Berkeley.EDU [169.229.60.163]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i721pEEV005271 for ; Mon, 2 Aug 2004 03:51:14 +0200 Received: from ZUNI (zuni.CS.Berkeley.EDU [128.32.35.230]) by relay0.EECS.Berkeley.EDU (8.13.0/8.12.10) with ESMTP id i721pCLL012876 for ; Sun, 1 Aug 2004 18:51:13 -0700 (PDT) Message-Id: <200408020151.i721pCLL012876@relay0.EECS.Berkeley.EDU> From: "Matt Harren" To: Subject: [Caml-list] equality testing in 3.08 Date: Sun, 1 Aug 2004 18:54:05 -0700 X-Mailer: Microsoft Office Outlook, Build 11.0.5510 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 Thread-index: AcR4M5daAUdfQbPwQuejucRu2Z2MzA== X-Miltered: at nez-perce with ID 410D9E12.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; operands:01 slower:01 cyclic:01 pervasives:01 sympathy:01 cyclic:01 bool:01 ocaml:01 ocaml:01 equality:01 equality:01 checking:01 comparison:02 identifier:03 module:03 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hi, I recently upgraded to OCaml 3.08, and ran into problems with the changed implementation of structural equality. To support NaN, the (=) operator no longer checks for physical equality or its operands. This causes two problems: 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. 2) We've been cheating and using (=) on structures that may be cyclic. This works fine on earlier versions of ocaml, because the structures contain a unique identifier as their first field. But now that structural equality checks no longer begin with a physical equality check, we can get an infinite loop. To work around this, I've been defining let (=) x1 x2 : bool = (compare x1 x2) = 0 at the start of each file, since the "compare" function still starts with a physical equality check. Is there a better way to override a definition in the Pervasives module? Also, has there been any discussion of restoring the old meaning of (=)? I know it breaks NaN, but the performance difference might make this worthwhile, even if you have no sympathy for those of us who use = on cyclic structures. :) Thanks, Matt ------------------- 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