From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id EBAACBB84 for ; Thu, 18 May 2006 01:14:27 +0200 (CEST) Received: from web32203.mail.mud.yahoo.com (web32203.mail.mud.yahoo.com [68.142.207.134]) by nez-perce.inria.fr (8.13.0/8.13.0) with SMTP id k4HNEQTX030793 for ; Thu, 18 May 2006 01:14:27 +0200 Received: (qmail 30291 invoked by uid 60001); 17 May 2006 23:14:26 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=W/b8Yc6V2MSczLOgOK0aAhc4ISReblFMKpJRsycpLqZbUCfeYO3mH/ZABc1tEmhkt8Oqv6OQpU0ZaQqIx0Ap7q+Si2tgNdcMfbCvHxbvGbj/zuZ0MNuOH/YVMBs3R5kgH67ZDCJClwYirtS0NYKzo5XbYawxN377NM1QUI53D7w= ; Message-ID: <20060517231426.30289.qmail@web32203.mail.mud.yahoo.com> Received: from [128.111.54.206] by web32203.mail.mud.yahoo.com via HTTP; Wed, 17 May 2006 16:14:26 PDT Date: Wed, 17 May 2006 16:14:26 -0700 (PDT) From: Dan Koppel Subject: compiler bug? To: caml-list@yquem.inria.fr MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-116759665-1147907666=:30255" Content-Transfer-Encoding: 8bit X-j-chkmail-Score: MSGID : 446BAE52.000 on nez-perce : j-chkmail score : XX : 0/20 2 X-Miltered: at nez-perce with ID 446BAE52.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; compiler:01 bug:01 bug:01 ocaml:01 compiler:01 inserting:01 -inline:01 ocamlopt:01 unix:01 gettimeofday:01 ocamlopt:01 unix:01 cmxa:01 ocaml:01 inserting:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: **** X-Spam-Status: No, score=4.1 required=5.0 tests=DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_WHOIS,FORGED_YAHOO_RCVD,FROM_ENDS_IN_NUMS,HTML_20_30, HTML_MESSAGE autolearn=disabled version=3.0.3 --0-116759665-1147907666=:30255 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Hello Caml Group, I would like to report what I think might be a bug in the Ocaml compiler. But first I wanted to run this by this group in case there's something I'm missing. I have some very simple code that consists of 2 nested loops. Inside the inner loop, is a simple statement. Furthermore, the inner loop is not "tight". Ie. the number of iterations within the inner loop is very large and the number of iterations of the outer loop is very small. I then manually time this. I then change the code by inserting a simple function call between the inner and outer loops. This should have virtually no effect whatsoever. However, when I time this, I get exactly twice the time. This is somewhat inexplicable. I tried tinkering with the "-inline" option for ocamlopt but this had no effect. Below is the actual code (main.ml): let main () = let dummy1 = ref 0 in let dummy2 = ref 0.0 in for i = 1 to 4 do for j = 1 to 1000000000 do dummy1 := !dummy1 + 1; dummy1 := !dummy1 - 1 done; dummy2 := Unix.gettimeofday () done let _ = main () I compile as follows: ocamlopt unix.cmxa main.ml and run: ./a.out Is this in fact a bug of the ocamlopt compiler? Or is there some way currently to make this effect disappear? Thanks for any help! Sincerely, Dan Koppel --------------------------------- Sneak preview the all-new Yahoo.com. It's not radically different. Just radically better. --0-116759665-1147907666=:30255 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 8bit
Hello Caml Group,
  I would like to report what I think might be a bug in the Ocaml compiler.  But first I wanted to run this by this group in case there's something I'm missing.  I have some very simple code that consists of 2 nested loops.  Inside the inner loop, is a simple statement.  Furthermore, the inner loop is not "tight".  Ie. the number of iterations within the inner loop is very large and the number of iterations of the outer loop is very small.  I then manually time this.  I then change the code by inserting a simple function call between the inner and outer loops.  This should have virtually no effect whatsoever.  However, when I time this, I get exactly twice the time.  This is somewhat inexplicable.  I tried tinkering with the "-inline" option for ocamlopt but this had no effect.  Below is the actual code (main.ml):
 
let main () =
  let dummy1 = ref 0 in
  let dummy2 = ref 0.0 in
  for i = 1 to 4 do
    for j = 1 to 1000000000 do
      dummy1 := !dummy1 + 1;
      dummy1 := !dummy1 - 1
    done;
    dummy2 := Unix.gettimeofday ()
  done
 
let _ = main ()
 
I compile as follows: ocamlopt unix.cmxa main.ml
and run: ./a.out
 
Is this in fact a bug of the ocamlopt compiler?  Or is there some way currently to make this effect disappear?
 
Thanks for any help!
Sincerely,
  Dan Koppel


Sneak preview the all-new Yahoo.com. It's not radically different. Just radically better. --0-116759665-1147907666=:30255--