Version française
Home     About     Download     Resources     Contact us    
Browse thread
Function Inlining
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Ville-Pertti Keinonen <will@e...>
Subject: Re: [Caml-list] Function Inlining
Jonathan Bryant wrote:
> What is the deal with the -inline option for ocamlopt?  I've turned it
> off (0), turned it on (1), turned it up (10 - 100) and gone crazy
> (10000) with it.  Yet my executable says exactly the same size and runs
> in exactly the same time.  I know inlining functions leads to code
> bloating and (usually) performance increases, so I'm confused.  Is it
> not working?  I have both large and small functions so it's not that
> they are all getting inlined any time it is on.  Besides turning it off
> makes no difference.

> What's going on here?

You're probably running into restrictions other than size that OCaml has 
on function inlining, such as function definitions inside the function, 
structured constants and let rec.

Getting rid of these restrictions could potentially improve OCaml code 
generation considerably, but as far as I can tell, that would require 
some additional features in the code generation such as sharing 
structured constants, explicitly transforming tail calls to loops etc.