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
Native code compile time question
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2008-09-05 (21:32)
From: Basile STARYNKEVITCH <basile@s...>
Subject: Re: [Caml-list] Native code compile time question
Raj Bandyopadhyay wrote:
> Hi all
> I am implementing a language by generating OCaml code for input source 
> and using the OCaml native code compiler. However, I've run into a 
> strange problem.

> On using my code generator on a large program, I generate a file containing about 75K lines of OCaml.
> The native code compiler takes more than 30 *minutes* to compile this file!  The bytecode compiler takes about 5 secs. 

It depends of your langage and of the code you are generating, but maybe 
Ocaml is not the right tool for that. Did you consider stuff like LLVM or C-- both designed to be 
languages to be generated by a program (not to be coded in by a human)?

It could also be that you are generating huge functions. Avoid 
generating huge functions (and you'll get the same kind of troubles if 
you generate huge C functions).

All the low level code generation issues and algorithms (e.g. 
instruction scheduling, register allocation) are violently non linear.

email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mines, sont seulement les miennes} ***