Version française
Home     About     Download     Resources     Contact us    
Browse thread
Is OCaml fast?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Sylvain Le Gall <sylvain@l...>
Subject: Re: Is OCaml fast?
Hello,

On 22-11-2010, Thanassis Tsiodras <ttsiodras@gmail.com> wrote:
> I apologize beforehand if this is not the forum to ask.
>
> I am on the fence about whether to learn OCaml or not, and while
> reading an article called "Why OCaml"
> (http://www.cs.ubc.ca/~murphyk/Software/Ocaml/why_ocaml.html), I saw
> that OCaml was praised for the speed of the executables it generates -
> and was referred to, speed-wise, as "second to none", except C and
> C++.
>
> However, when I actually went to the Language Shootout page suggested
> in the article, I found out that OCaml is not 2nd, it is 13th, behind
> languages like Haskell and C#...
> (http://shootout.alioth.debian.org/u32/which-programming-languages-are-fastest.php)

Shootout benchmarks doesn't always allow to set some variables that
could greatly improve the speed of OCaml.

>
> Is it just hype, then? Or am I missing something?
>

You could write very fast application with OCaml -- even beating C code
in some case. But what OCaml is really helpful for, is that you can do
algorithmic optimizations that improve the speed. It means that OCaml
is terse enough to allow you to write complex algorithm without making
too much bugs. 

All in all: development time + execution time is fast.

But if you spend 10x development time on the same C code, you will
obviously get something faster in C. 

Regards,
Sylvain Le Gall