From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=1.3 required=5.0 tests=AWL,SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id D3E9BBC0A for ; Fri, 20 Apr 2007 22:31:52 +0200 (CEST) Received: from ik-out-1112.google.com (ik-out-1112.google.com [66.249.90.182]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l3KKVpFL017635 for ; Fri, 20 Apr 2007 22:31:52 +0200 Received: by ik-out-1112.google.com with SMTP id c29so1101153ika for ; Fri, 20 Apr 2007 13:31:51 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:mime-version:content-type:content-transfer-encoding:content-disposition; b=pOPwRxQdq7GfPehQhL4+EwVuNhYANU45HW1PBGSVpCqHwolF8njxnwf9SKQSlQjvvGvxkDTmw74x5yjIU3+bG9sSJrxJiln005DVAKmvtBlKZTpTn/SAaYs+DWqXrl/STvO0krB9LvVdOD/wVJnVQ5FWRK4P+7VNSAYhbFfjFM8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:mime-version:content-type:content-transfer-encoding:content-disposition; b=kLN3bZaNPKgLp3tixH3/RtKRAOQjGZjVtTY8jzjxHFbepjfUWTTwIatyoBEzK2rmO46puwmdSHcrouX/zX4soT0y5I1dY8AI2WE6QdjCpSFsGMS3A5e4Hod2QWfrNDueWB7kFbB8YdNcKP5nWePyGh3N7A4MVlOy+Nwn8T3Qv+w= Received: by 10.78.200.3 with SMTP id x3mr596874huf.1177101110572; Fri, 20 Apr 2007 13:31:50 -0700 (PDT) Received: by 10.78.16.3 with HTTP; Fri, 20 Apr 2007 13:31:50 -0700 (PDT) Message-ID: Date: Fri, 20 Apr 2007 16:31:50 -0400 From: "Markus Mottl" To: ocaml Subject: Slow allocations with 64bit code? Cc: "yaron jane" MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline X-j-chkmail-Score: MSGID : 46292337.001 on discorde : j-chkmail score : X : 0/20 1 0.000 -> 1 X-Miltered: at discorde with ID 46292337.001 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; markus:01 mottl:01 markus:01 mottl:01 allocations:01 allocations:01 recompiled:01 alloc:01 alignment:01 ocaml:01 0.65:98 slower:01 int:01 caml:02 executable:03 Hi, I wonder whether others have already noticed that allocations may surprisingly be slower on 64bit platforms than on 32bit ones. I compiled the following code using an OCaml-compiler that generates 32bit code: ------------------------- let () = for i = 1 to 100000000 do ignore (Int32.add 42l 24l) done ------------------------- I ran it on a 64bit platform (Intel(R) Pentium(R) D CPU 2.80GHz), and it took 0.65 seconds to finish. Then I recompiled it on this same platform using an OCaml-compiler that generates 64bit code. Surprisingly, the resulting executable took 0.72 seconds to run! This is only a difference of about 10%, but I have seen more complex cases where there are timing differences in excess of 50%, which is already pretty substantial. Looking at the assembly, there is really no difference in the loop other than the use of the quad word instructions, which should not take longer on the exact same platform (i.e. same CPU-frequency). But there is a suspicious call to "caml_alloc2", which might cause these differences. Can it be that there are alignment problems or similar in the run time? In the considerably more complex code I'm currently working on it also seemed to me that it's allocations (the run time) that cause the performance difference. Regards, Markus -- Markus Mottl http://www.ocaml.info markus.mottl@gmail.com