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 concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 37C1EBB9A for ; Wed, 5 Oct 2005 00:39:30 +0200 (CEST) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.194]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j94MdTHj006675 for ; Wed, 5 Oct 2005 00:39:29 +0200 Received: by wproxy.gmail.com with SMTP id i5so11436wra for ; Tue, 04 Oct 2005 15:39:29 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=uG0+hC9Rg4GUR0lLmc2Tx68v1Oj5/X1opTs3BlPmORmY0EBPfnX9AMaHCeYeeJczPBNXwvJ6u/OQiziyRtSYLhhroiCbtRmaNUAXHZFJEjHaS8evUULNuO1JtsJnFwKOEkTfU/pD0CLuBbxSPz57yOxT2uP9A1RqghJ4B7t7Qz0= Received: by 10.54.147.17 with SMTP id u17mr46683wrd; Tue, 04 Oct 2005 15:39:28 -0700 (PDT) Received: by 10.54.95.18 with HTTP; Tue, 4 Oct 2005 15:39:28 -0700 (PDT) Message-ID: <8008871f0510041539r1d2b242fifcd09cf32ba394fa@mail.gmail.com> Date: Tue, 4 Oct 2005 18:39:28 -0400 From: "Christopher A. Watford" Reply-To: "Christopher A. Watford" To: Oliver Bandel Subject: Re: FP/IP and performance (in general) and Patterns... (Re: [Caml-list] Avoiding shared data) Cc: caml-list@yquem.inria.fr In-Reply-To: <20051004164700.GA494@first.in-berlin.de> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <20051003200337.14092.qmail@web26809.mail.ukl.yahoo.com> <1128394430.23813.20.camel@rosella> <20051004164700.GA494@first.in-berlin.de> X-Miltered: at concorde with ID 434304A1.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 avoiding:01 oliver:01 bandel:01 oliver:01 in-berlin:01 pointer:01 functor:01 trolls:01 compiler:01 ocaml:01 ...:98 ...:98 'my:98 wrote:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_BY_IP autolearn=disabled version=3.0.3 On 10/4/05, Oliver Bandel wrote: > Hello, > > is there a general overvie (paper or book), where > functional and imperative approaches to solve a problem are > compared directly? > > Most often people say, imperative is faster in most of all > cases, and only in some cases FP might be faster. > > If there is a paper/book about problem solving and performance, > comparing different approaches I would be happy to have a pointer > to it. > > Also it would be nice to find something about how > classical imperative style, OO-style and FP-style > are solving problems, and which patterns can be done > easier in the one or the other way. > > I recently had a discussion about some OO-patterns > ( so called "GoF"-Book) and tried to solve some of them with > OCamls module system. > Adapter and bridge was talked about. Adapter was easy in writing a simple > wrapper. > Bridge could be done with a functor. :) > > So, if there are direct translations possible, where to find > comparisons? > > Another interesting theme in this respect is: If not only some patterns > were adapted to Fp, but the whole problem solving approach is different, > which patterns will be unnevcessary then, because the whole structure of > the software will be different...?! > > Ciao, > Oliver Sigh, your question only begs for trolls to pop out of the corners. It would probably be best to keep these questions off this list. Far too often they go off into the deep end of the 'my language is better than your language' debates. Obviously members of this list are going to be biased towards functional languages and will probably give you biased articles to read or biased papers. Not necessarily biased in a bad way, just more likely to show functional languages in a good light. A poor place to start reading on the subject of what language is best is The Computer Language Shootout [1]. An even worse place to start reading is this list. The actual performance for any program will depend largely on your ability to program well for the language and for the specific compiler you choose. I would say it's obvious that some patterns are easier to *write* in a certain language, but that hardly shows which language is *best* speed wise. Your example shows one pattern functional languages are well suited for, however, I'm sure an experienced C programmer could show you an example of that pattern which is both efficient and easy to read (I know I know people on this list may disagree). This list is best for asking OCaml questions and is awful for asking for what language is best for what, nobody agrees. -- Christopher A. Watford christopher.watford@gmail.com [1] http://shootout.alioth.debian.org/