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: Christophe TROESTLER <Christophe.Troestler+ocaml@u...>
Subject: Re: [Caml-list] Correct way of programming a CGI script
On Tue, 09 Oct 2007 09:05:03 +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:

Are you sure you are comparing string manipulation and languages here?

> s= "a"
> x = ""
> for i in xrange(0,10000000):
>   x = x+s
> print "done"
> 
> Time: 6 seconds. Without optimisation switched on.

Time: 6.238s Without optimisation switched on.

> Ocaml:

  let x = ref(Rope.of_string "")
  let s = Rope.of_string "a";;
  for i = 0 to 10_000_000 do
    x := Rope.concat2 !x s
  done;;
  print_endline "done"

Time: 2.047s Without optimisation switched on.

Cheers,
ChriS