Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
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 <basile.starynkevitch@inria.fr> 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:

Test__f_57:
.L100:
        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
        ret
.L102:  call    caml_call_gc
.L103:  jmp     .L101

Test__g_62:
.L104:
        lea     -1(%eax, %ebx), %eax
        ret


--
... WBR, Evgeny ...

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners