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=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 6131EBC0B for ; Tue, 23 Jan 2007 12:44:29 +0100 (CET) Received: from amazone2.ujf-grenoble.fr (amazone2.ujf-grenoble.fr [152.77.2.202]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l0NBiUFX028772 for ; Tue, 23 Jan 2007 12:44:30 +0100 Received: from tana2.ujf-grenoble.fr (tana2.ujf-grenoble.fr [152.77.24.22]) by amazone2.ujf-grenoble.fr (8.13.7/8.13.7/Configured by JE 21 07 2006) with ESMTP id l0NBiSqg091316 for ; Tue, 23 Jan 2007 12:44:28 +0100 (CET) Received: from localhost (unknown [127.0.0.1]) by tana2.ujf-grenoble.fr (Postfix) with ESMTP id BA1E725042E for ; Tue, 23 Jan 2007 12:44:28 +0100 (CET) X-Virus-Scanned: Scanned on tana2.ujf-grenoble.fr Received: from tana2.ujf-grenoble.fr ([127.0.0.1]) by localhost (tana2.ujf-grenoble.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id v5l7xH1D8j+d for ; Tue, 23 Jan 2007 12:44:28 +0100 (CET) Received: from tibre1.ujf-grenoble.fr (tibre1.ujf-grenoble.fr [152.77.18.86]) by tana2.ujf-grenoble.fr (Postfix) with ESMTP id 2509725043A for ; Tue, 23 Jan 2007 12:44:28 +0100 (CET) Received: from ifapp1.ujf-grenoble.fr (mozart.ujf-grenoble.fr [193.54.241.5]) by tibre1.ujf-grenoble.fr (8.13.3/8.13.3) with ESMTP id l0NBiS2e029697 for ; Tue, 23 Jan 2007 12:44:28 +0100 (CET) (envelope-from san.vu-ngoc@ujf-grenoble.fr) Received: from [193.48.255.250] ([::ffff:193.48.255.250]) by fourier.ujf-grenoble.fr with esmtp; Tue, 23 Jan 2007 12:44:27 +0100 id 0000F98A.45B5F51B.0000268A Message-ID: <45B5F51B.8060609@ujf-grenoble.fr> Date: Tue, 23 Jan 2007 12:44:27 +0100 From: Vu Ngoc San User-Agent: IceDove 1.5.0.9 (X11/20061220) MIME-Version: 1.0 To: Jon Harrop Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] function definition References: <45B36075.5000608@ujf-grenoble.fr> <200701211742.51582.jon@ffconsultancy.com> In-Reply-To: <200701211742.51582.jon@ffconsultancy.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 45B5F51E.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; inlined:01 binop:01 binop:01 byte:01 bewteen:01 caml-list:01 inline:01 inline:01 surprising:01 defined:02 native:02 native:02 seems:03 1300:96 debian:03 Thanks for the reply. So, I have tried to do some benchmarking, and the results are surprising. The method: a (for i=1 to ... do) loop. I have tried first an inlined test with ignore(binop1 Plus sin cos 1.) (and then binop2, binop3, binop4) Then I have defined the function f = binop1 Plus sin cos and tried the loop with ignore(f 1.) Here are the results (Linux debian 2.6.17-2-686, Intel(R) Pentium(R) M processor 1300MHz) BYTE CODE: Inline binop1 with 100000000 iterations:58736 msec. Inline binop2 with 100000000 iterations:59681 msec. Inline binop3 with 100000000 iterations:67663 msec. Inline binop4 with 100000000 iterations:68692 msec. f (binop1) with 100000000 iterations:53514 msec. f (binop2) with 100000000 iterations:47794 msec. f (binop3) with 100000000 iterations:53315 msec. f (binop4) with 100000000 iterations:59411 msec. NATIVE CODE: Inline binop1 with 100000000 iterations:25017 msec. Inline binop2 with 100000000 iterations:25860 msec. Inline binop3 with 100000000 iterations:26310 msec. Inline binop4 with 100000000 iterations:24251 msec. f (binop1) with 100000000 iterations:25512 msec. f (binop2) with 100000000 iterations:25620 msec. f (binop3) with 100000000 iterations:25554 msec. f (binop4) with 100000000 iterations:24801 msec. The last method (binop4) is clearly the slowest in bytcode and the fastest in native code ! In native code, the difference bewteen the slowest and the fastest reaches 8%. This seems to me significant enough, but I don't know whether it depends on the system architecture or not. Best San