Version française
Home     About     Download     Resources     Contact us    
Browse thread
AST versus Ocaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Mauricio Fernandez <mfp@a...>
Subject: Re: [Caml-list] ATS versus Ocaml
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