From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id DB4B9BC6B for ; Wed, 6 Jun 2007 18:14:03 +0200 (CEST) Received: from mail.cs.rice.edu (mail.cs.rice.edu [128.42.1.31]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l56GE1j1013759 for ; Wed, 6 Jun 2007 18:14:03 +0200 Received: from mail.cs.rice.edu (localhost.localdomain [127.0.0.1]) by mail.cs.rice.edu (Postfix) with ESMTP id 4C0F62C2ABD for ; Wed, 6 Jun 2007 11:14:01 -0500 (CDT) X-Virus-Scanned: by amavis-2.4.0 at mail.cs.rice.edu Received: from mail.cs.rice.edu ([127.0.0.1]) by mail.cs.rice.edu (mail.cs.rice.edu [127.0.0.1]) (amavisd-new, port 10024) with LMTP id KE7LK7151MOe for ; Wed, 6 Jun 2007 11:13:53 -0500 (CDT) Received: from [10.249.109.2] (dunwlessnat.rice.edu [128.42.64.251]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by mail.cs.rice.edu (Postfix) with ESMTP id 887162C2AAE for ; Wed, 6 Jun 2007 11:13:53 -0500 (CDT) Mime-Version: 1.0 (Apple Message framework v750) Content-Transfer-Encoding: 7bit Message-Id: <79BFC310-5500-40EE-97A5-88FA56C643B2@rice.edu> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed To: caml-list@yquem.inria.fr From: Raj B Subject: Native compiler optimizations Date: Wed, 6 Jun 2007 11:13:50 -0500 X-Mailer: Apple Mail (2.750) X-Miltered: at discorde with ID 4666DD49.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; compiler:01 ocaml:01 compiler:01 ocaml:01 recursion:01 threads:01 threads:01 imperative:01 native:02 native:02 fortran:02 sequences:05 raj:05 raj:05 i'd:05 Hi This is a fairly broad question, but I do need as much info as I can get. I'm trying to understand how the OCaml native code compiler works in order to improve my application's performance. What kind of compiler optimizations are performed by the OCaml native code compiler? In particular, what does it do in case of imperative features (loop, references, sequences). Are there common compiler optimizations that it does not do, especially compared to C or Fortran? ('Optimizations', of course, is a very broad term) I've also read somewhere that OCaml optimizes tail-recursion. Does that mean I don't need to write for/while-loops if I don't want to without worrying about performance? Recursion does look cleaner :) This is probably a much-discussed topic, and I have looked at some of the older threads (2005 and older). However, I'd appreciate any new information. The older threads talk about a few books in progress discussing these issues. If there's a specific section of the OCaml code base I should stare at, I'd be glad to know too. Thanks Raj