Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Does Caml have slow arithmetics ?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-07-07 (14:26)
From: Evgeny Chukreev <sjah@l...>
Subject: Re: [Caml-list] Does Caml have slow arithmetics ?
On Wed, 7 Jul 2004 11:13:08 +0200
    Basile Starynkevitch <> wrote:

BSl> In practice, real code do memory allocation, pattern matching,
BSl> etc.. On this, Ocaml excels (and perform probably better than C or
BSl> C++); more generally, Ocaml is good for real non-trivial programs.

Do developers plan to add new kinds of optimization in a near future?

Trivial example:

let f a b =
    let a, b = a, b in
        a + b

let g a b =
    a + b

Compiled in:

        movl    %eax, %ecx
.L101:  movl    young_ptr, %eax
        subl    $12, %eax
        movl    %eax, young_ptr
        cmpl    young_limit, %eax
        jb      .L102
        leal    4(%eax), %eax
        movl    $2048, -4(%eax)
        movl    %ecx, (%eax)
        movl    %ebx, 4(%eax)
        movl    4(%eax), %ebx
        movl    (%eax), %eax
        lea     -1(%eax, %ebx), %eax
.L102:  call    caml_call_gc
.L103:  jmp     .L101

        lea     -1(%eax, %ebx), %eax

... WBR, Evgeny ...

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: