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 mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 1BAD9BBAF for ; Mon, 22 Nov 2010 16:02:07 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AkYBAPMU6kzU4366kGdsb2JhbACDSp8PFQEBAQEJCQwHEQMfiCukAJBfAoEggzZzBIcNhl8 X-IronPort-AV: E=Sophos;i="4.59,236,1288566000"; d="scan'208";a="67830502" Received: from moutng.kundenserver.de ([212.227.126.186]) by mail3-smtp-sop.national.inria.fr with ESMTP; 22 Nov 2010 16:02:06 +0100 Received: from office1.lan.sumadev.de (dslb-094-219-216-091.pools.arcor-ip.net [94.219.216.91]) by mrelayeu.kundenserver.de (node=mrbap1) with ESMTP (Nemesis) id 0LcVQE-1Oczbm22dy-00k5FR; Mon, 22 Nov 2010 16:02:04 +0100 Received: from [192.168.5.106] (dslb-094-219-216-091.pools.arcor-ip.net [94.219.216.91]) by office1.lan.sumadev.de (Postfix) with ESMTPA id 38F415F701; Mon, 22 Nov 2010 16:02:04 +0100 (CET) Subject: Re: [Caml-list] Is OCaml fast? From: Gerd Stolpmann To: bluestorm Cc: Thanassis Tsiodras , caml-list@yquem.inria.fr In-Reply-To: References: <1290434674.16005.354.camel@thinkpad> Content-Type: text/plain; charset="UTF-8" Date: Mon, 22 Nov 2010 16:02:02 +0100 Message-ID: <1290438122.16005.361.camel@thinkpad> Mime-Version: 1.0 X-Mailer: Evolution 2.28.1 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V02:K0:5fOsb5kdWEHvbBxcqLm/3NVJ9EEy9SW03+Ty4tSL/Xv NMAO3+jT7nKhX8P7Nuavr5LbHaBeR5GvVHHcs+vAztJhpeoZ2D 8FZ1+PEoBmyjhSr/V+5XjbBO823w4XhNJS3wrXIB4UahM/KLto Y0UdShGPdMCkadwkBEf6OyrcmRUeN0LAnNJVokjJ9tIYlXLif8 lPH9U70kjV8ep0dkO5dDQ== X-Spam: no; 0.00; ocaml:01 gerd:01 stolpmann:01 gerd:01 stolpmann:01 ocaml:01 runtime:01 malloc:01 darmstadt:01 6151:01 6151:01 deed:98 wrote:01 encode:01 heap:01 Am Montag, den 22.11.2010, 15:36 +0100 schrieb bluestorm: > On Mon, Nov 22, 2010 at 3:04 PM, Gerd Stolpmann > wrote: > I think the shootout is not a good data source. There are > definitely > some very poor Ocaml results there, so I'd guess the shootout > got > recently more attention by enthusiasts of other languages, and > the > current Ocaml programs there are not very good. (I remember > Ocaml was #1 > at the shootout a few years ago, faster than C.) So maybe a > good > opportunity to post better Ocaml solutions there? >=20 >=20 > As Sylvain noticed, some (in not most) of the OCaml poor performances > in the shootout are actually not due to bad OCaml programs, but to > arbitrary restrictions in the shootout rules. For example, one of the > bad-performing benchmark for OCaml is the binary-tree benchmark, where > it is nearly four times slower than C, but on closer inspection you > discover that this is due to the arbitrary choice to forbid any change > of the GC parameters. With appropriate GC parameters, the very same > OCaml program is exactly as fast as C. >=20 >=20 > http://shootout.alioth.debian.org/u32/performance.php?test=3Dbinarytree= s >=20 >=20 > =C2=AB Note: these programs are being measured with the default initial > heap size - the measurements may be very different with a larger > initial heap size or GC tuning. =C2=BB > C version : 12.11 secs > OCaml version : 47.22 secs > OCaml version with GC parameters tuned ("interesting alternative" > section) : 12.67 secs >=20 >=20 >=20 >=20 > Therefore, there is nothing that can be changed to the OCaml > submission for this benchmark to improve performances, except changing > the default GC parameters; while this might be a good idea in general, > changing it only for the sake of shootout-obsessed people is > ridiculous. It's in deed an unfair comparison: In C they use the Apache runtime which provides memory pools. This is something that does not extend to most real world programs. Because it's ridiculous anyway: Encode the tree in an array. Not really idiomatic, but in C they also do not use the idiomatic memory management (malloc/free). Gerd --=20 ------------------------------------------------------------ Gerd Stolpmann, Bad Nauheimer Str.3, 64289 Darmstadt,Germany=20 gerd@gerd-stolpmann.de http://www.gerd-stolpmann.de Phone: +49-6151-153855 Fax: +49-6151-997714 ------------------------------------------------------------