From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id A5DFEBC32 for ; Tue, 15 Mar 2005 21:35:52 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j2FKZqGN030024 for ; Tue, 15 Mar 2005 21:35:52 +0100 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id VAA24031 for ; Tue, 15 Mar 2005 21:35:51 +0100 (MET) Received: from ptb-relay01.plus.net (ptb-relay01.plus.net [212.159.14.212]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j2FKZpdP011682 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 15 Mar 2005 21:35:51 +0100 Received: from [80.229.56.224] (helo=chetara) by ptb-relay01.plus.net with esmtp (Exim) id 1DBIlb-000BYm-0i for caml-list@inria.fr; Tue, 15 Mar 2005 20:35:51 +0000 From: Jon Harrop Organization: Flying Frog Consultancy Ltd. To: caml-list@inria.fr Subject: Re: [Caml-list] OCaml troll on Slashdot Date: Tue, 15 Mar 2005 20:36:45 +0000 User-Agent: KMail/1.7.1 References: <42363A86.6010309@1969.ws> <200503150859.55997.jon@ffconsultancy.com> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200503152036.45894.jon@ffconsultancy.com> X-Miltered: at concorde with ID 42374728.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 42374727.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 ocaml:01 ocaml:01 timings:01 iirc:01 1.5:98 coward:98 frog:98 wrote:01 jacques:01 caml:02 functional:02 objective:02 programming:03 optimization:03 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.2 X-Spam-Level: On Tuesday 15 March 2005 20:17, Yoann Padioleau wrote: > I have made the obvious optimization which is to replace the assoc list by > a Map (just changing 4 lines in the "troll" code), > the ocaml version is then far far faster. > > But computing 7 by 7 with c++ take 1.5 sec and with > ocaml 50.0 sec (but it is better than "more than 16 minutes"). I spent a little time on it but some Anonymous Coward has already done a much better job and posted the resulting code on Jacques Garrigue's website. ;-) I also posted the resulting timings on slashdot. IIRC, OCaml was less than half as much code and ran in 1.66 times the time (if you unroll the most time consuming function a little). That's pretty much what I'd expect given that the problem is too simple and array-based to take much advantage of OCaml and functional programming. -- Dr Jon D Harrop, Flying Frog Consultancy Ltd. Objective CAML for Scientists http://www.ffconsultancy.com/products/ocaml_for_scientists