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 |
Chris Hecker <checker@d6.com> writes:
>>* The GNU C compiler gcc is recommended, as the bytecode
>> interpreter takes advantage of gcc-specific features to enhance
>> performance.
>>What is the nature of these optimizations?
>
> GCC lets you take the address of a label. You can see in
> byterun/interp.c that it uses a jump table instead of a switch when
> you're using GCC.
>
> At least, that's what it looks like.
I would rather say that gcc allows to force register allocation for some
specific variable, while MSVC always ignore "register" specifier.
#if defined(__GNUC__) && !defined(DEBUG)
[...]
#ifdef __i386__
#define PC_REG asm("%esi")
#define SP_REG asm("%edi")
#define ACCU_REG
#endif
[...]
#endif
/* The interpreter itself */
value interprete(code_t prog, asize_t prog_size)
{
#ifdef PC_REG
register code_t pc PC_REG;
register value * sp SP_REG;
register value accu ACCU_REG;
#else
register code_t pc;
register value * sp;
register value accu;
#endif
In the same time MSVC has very good optimizer and it is very strange, that
two explicit register variables lead to 30% performance gain...
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