English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Comparison of OCaml and MLton for numerics
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-06-01 (16:53)
From: Jon Harrop <jon@f...>
Subject: Re: [Caml-list] Comparison of OCaml and MLton for numerics
On Friday 01 June 2007 16:40:46 Alain Frisch wrote:
> Another good situation is when inlining allows the compiler to turn a
> function call to an unknown location into a direct function call (or no
> function call at all). This happens as soon as you write "List.map (fun
> x -> ...)". Inlining List.map would avoid the allocation of the closure
> and a computed call (and then the local abstraction will also be inlined
> in the body of the inlined List.map because it is used only once).
> Currently, OCaml never inlines recursive functions.

This is an excellent example of something that can be done simply and 
effectively by specializing only stdlib calls.

Float array operations are another place where OCaml leaves expensive checks 
in the inner loop unnecessarily:

  Array.fold_left (+.) 0.

Dr Jon D Harrop, Flying Frog Consultancy Ltd.
OCaml for Scientists