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 mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 08AFDBBAF for ; Fri, 6 Nov 2009 13:22:33 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvQCAPSj80rVBIoBc2dsb2JhbACbbwEMCgsHEwTAf4Q9BIFnhiE X-IronPort-AV: E=Sophos;i="4.44,692,1249250400"; d="scan'208";a="39646047" Received: from impaqm1.telefonica.net ([213.4.138.1]) by mail1-smtp-roc.national.inria.fr with ESMTP; 06 Nov 2009 13:22:32 +0100 Received: from IMPmailhost5.adm.correo ([10.20.102.126]) by IMPaqm1.telefonica.net with bizsmtp id 1kjn1d0082jdgqJ01oNX8R; Fri, 06 Nov 2009 13:22:31 +0100 Received: from NANA.localdomain ([88.6.6.99]) by IMPmailhost5.adm.correo with BIZ IMP id 1oN61d00k28BP741loN7FK; Fri, 06 Nov 2009 13:22:31 +0100 X-TE-authinfo: authemail="ferferse$telefonica.net" |auth_email="ferferse@telefonica.net" X-TE-AcuTerraCos: auth_cuTerraCos="cosuitnetc01" Received: from mfp by NANA.localdomain with local (Exim 4.69) (envelope-from ) id 1N6NpO-0006Pk-Hv; Fri, 06 Nov 2009 13:22:06 +0100 Date: Fri, 6 Nov 2009 13:22:06 +0100 From: Mauricio Fernandez To: Jan Kybic , caml-list@inria.fr Subject: Re: [Caml-list] ATS versus Ocaml Message-ID: <20091106122206.GA22140@NANA.localdomain> Mail-Followup-To: Jan Kybic , caml-list@inria.fr References: <878wem75iq.fsf@fel.cvut.cz> <200911042025.34897.jon@ffconsultancy.com> <87y6mmc4nv.fsf@fel.cvut.cz> <200911042315.55304.jon@ffconsultancy.com> <87fx8reuvr.fsf_-_@fel.cvut.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87fx8reuvr.fsf_-_@fel.cvut.cz> User-Agent: Mutt/1.5.17+20080114 (2008-01-14) X-Spam: no; 0.00; ocaml:01 0100,:01 ocaml:01 allocations:01 -unsafe:01 2009:98 0.13:98 wrote:01 caml-list:01 explicitly:02 implemented:02 checking:02 float:03 let:03 let:03 On Fri, Nov 06, 2009 at 12:48:56PM +0100, Jan Kybic wrote: > I have implemented two benchmarks: > > - eight queens, I actually used ten. I believe the original Ocaml > implementation was probably yours. It uses lists as a primary > structure, so there is a lot of allocations. On this task, ATS needs > about 50% more time than Ocaml. > > - bubble sort on an array of doubles. Here ATS is more than 10 times > faster than Ocaml (for n=10000). > > My code can be found at http://cmp.felk.cvut.cz/~kybic/share/ats_tests.zip I notice that in ATS you have to give the type of the array explicitly fn bubble_sort (a : array0 double ) : void = so you should also do so in the OCaml code, using let bubble_sort (a : float array) = instead of let bubble_sort a This makes the OCaml bsort over 13 times faster here (1.75 vs 0.13s). Do you know if ATS is performing array bound checking? The OCaml code is nearly 2X faster with -unsafe than without. -- Mauricio Fernandez - http://eigenclass.org