caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Mauricio Fernandez <mfp@acm.org>
To: Jan Kybic <kybic@fel.cvut.cz>, caml-list@inria.fr
Subject: Re: [Caml-list] ATS versus Ocaml
Date: Fri, 6 Nov 2009 13:22:06 +0100	[thread overview]
Message-ID: <20091106122206.GA22140@NANA.localdomain> (raw)
In-Reply-To: <87fx8reuvr.fsf_-_@fel.cvut.cz>

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


  parent reply	other threads:[~2009-11-06 12:22 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-04 14:01 AST " Jan Kybic
2009-11-04 14:41 ` [Caml-list] " Kevin Cheung
2009-11-04 15:42   ` Jan Kybic
2009-11-04 20:25     ` Jon Harrop
2009-11-04 22:21       ` Jan Kybic
2009-11-04 23:15         ` Jon Harrop
2009-11-06 11:48           ` [Caml-list] ATS " Jan Kybic
2009-11-06 12:11             ` Sylvain Le Gall
2009-11-06 15:38               ` [Caml-list] " Jan Kybic
2009-11-07  1:56                 ` Jacques Garrigue
2009-11-07 19:00                 ` Jon Harrop
2009-11-06 12:22             ` Mauricio Fernandez [this message]
2009-11-04 15:37 ` [Caml-list] AST " malc

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091106122206.GA22140@NANA.localdomain \
    --to=mfp@acm.org \
    --cc=caml-list@inria.fr \
    --cc=kybic@fel.cvut.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).