Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] equality testing in 3.08
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-08-02 (11:05)
From: Christophe TROESTLER <debian00@t...>
Subject: Re: [Caml-list] equality testing in 3.08
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
          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).


To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: