Browse thread
[Caml-list] Timing Ocaml
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Dmitry Bely <dbely@m...> |
| Subject: | Re: [Caml-list] Timing Ocaml |
Xavier Leroy <xavier.leroy@inria.fr> writes:
>> Reading that the bytecode interpreter for Ocaml runs 2/3 as fast
>> when compiled with VC 6 compared to gcc, has anybody done any
>> timing comparisons with VisualStudio.Net, Intel C++ 5.x or
>> Intel C++ 6.0?
>
> As others mentioned, the reason why gcc does a better job on the Caml
> bytecode interpreter is not that gcc generates better code all by
> itself (it doesn't), but that it supports "computed gotos" as a C
> language extension. The bytecode interpreter takes advantage of this
> feature by replacing opcodes with the addresses of the code fragments that
> execute them, saving a significant amount of time in the bytecode
> interpretation loop.
>
> Microsoft's C compilers don't support this extension, and I doubt
> Intel's compilers do, at least under Windows. (Although I seem to
> remember that Intel's compiler for Linux implements gcc extensions.)
Thank a lot for the explanation. But why then not to use inline asm for
MSVC, something like that:
#if defined(__GNUC__) && __GNUC__ >= 2
#define indirect_goto(addr) goto (addr)
#elif defined(_MSC_VER)
#define indirect_goto(addr) \
{ void* a = addr; __asm jmp dword ptr a; }
#endif
Hope to hear from you soon,
Dmitry
-------------------
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