Version française
Home     About     Download     Resources     Contact us    
Browse thread
Correct way of programming a CGI script
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: skaller <skaller@u...>
Subject: Re: [Caml-list] Correct way of programming a CGI script
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 <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net