From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=AWL autolearn=disabled version=3.1.3 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 7B727BC6B for ; Tue, 9 Oct 2007 01:20:39 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAP5XCkfLENaMnmdsb2JhbACORQEBAQEHBAYRGA X-IronPort-AV: E=Sophos;i="4.21,244,1188770400"; d="scan'208";a="4073552" Received: from discorde.inria.fr ([192.93.2.38]) by mail3-smtp-sop.national.inria.fr with ESMTP; 09 Oct 2007 01:20:39 +0200 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l98NKcRw029275 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Tue, 9 Oct 2007 01:20:39 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAP5XCkfLENaMnmdsb2JhbACORQEBAQEHBAYRGA X-IronPort-AV: E=Sophos;i="4.21,244,1188770400"; d="scan'208";a="4073551" Received: from ipmail01.adl2.internode.on.net ([203.16.214.140]) by mail3-smtp-sop.national.inria.fr with ESMTP; 09 Oct 2007 01:20:37 +0200 X-IronPort-AV: E=Sophos;i="4.21,244,1188743400"; d="scan'208";a="206591280" Received: from ppp121-44-36-108.lns10.syd7.internode.on.net (HELO [192.168.1.201]) ([121.44.36.108]) by ipmail01.adl2.internode.on.net with ESMTP; 09 Oct 2007 08:49:24 +0930 Subject: Re: [Caml-list] Correct way of programming a CGI script From: skaller To: caml-list@inria.fr In-Reply-To: <1191884703.26491.9.camel@rosella.wigram> References: <1191859489.10162.16.camel@localhost.localdomain> <1191879429.28011.27.camel@rosella.wigram> <20071009082147.657017dc.mle+ocaml@mega-nerd.com> <1191884703.26491.9.camel@rosella.wigram> Content-Type: text/plain Date: Tue, 09 Oct 2007 09:19:22 +1000 Message-Id: <1191885562.26491.17.camel@rosella.wigram> Mime-Version: 1.0 X-Mailer: Evolution 2.10.1 Content-Transfer-Encoding: 7bit X-Miltered: at discorde with ID 470ABB46.001 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ocaml:01 ocaml:01 forall:01 sourceforge:01 wrote:01 wrote:01 caml-list:01 int:01 strings:01 len:02 binary:02 idiomatic:02 string:02 python:03 python:03 On Tue, 2007-10-09 at 09:05 +1000, skaller wrote: > On Tue, 2007-10-09 at 08:21 +1000, Erik de Castro Lopo wrote: > > skaller wrote: > > > While I agree that yes, it is possible to write slow code in Ocaml > > (or any other language), I suspect that idiomatic Ocaml string handling > > compiled to a binary is just as fast if not faster than Java/Perl/Python/ > > Ruby/PHP/whatever. > > Fraid not. Python eats Ocaml alive. Python: > > s= "a" > x = "" > for i in xrange(0,10000000): > x = x+s > print "done" > > Time: 6 seconds. Without optimisation switched on. And here is the Felix (C++) version: int i; var x = ""; s := "a"; forall i in 1 upto 10_000_000 do x += s; done; println$ len x; Time: 0m0.198s Which eats Python for breakfast .. forget about Ocaml. For 100 million strings, time: 0m1.795s. I don't have enough RAM to test the next decimal O. -- John Skaller Felix, successor to C++: http://felix.sf.net