From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p0B8r31c032266 for ; Tue, 11 Jan 2011 09:53:03 +0100 X-IronPort-AV: E=Sophos;i="4.60,306,1291590000"; d="scan'208";a="84802764" Received: from bne75-9-88-168-234-79.fbx.proxad.net (HELO [192.168.0.15]) ([88.168.234.79]) by mail4-relais-sop.national.inria.fr with ESMTP/TLS/AES128-SHA; 11 Jan 2011 09:52:58 +0100 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Apple Message framework v1082) From: Damien Doligez In-Reply-To: <4D2B7893.5030802@mcmaster.ca> Date: Tue, 11 Jan 2011 09:52:58 +0100 Message-Id: References: <4D2B7893.5030802@mcmaster.ca> To: caml users X-Mailer: Apple Mail (2.1082) Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by walapai.inria.fr id p0B8r31c032266 Subject: Re: [Caml-list] Can this be inlined? On 2011-01-10, at 22:22, Jacques Carette wrote: > I am experimenting with some fairly generic traversal code (over a complex AST), but am a little scared that the result will be horribly inefficient. Note that in your code the function oapply only adds constant overhead to some function calls (and these are probably non-trivial functions). So in any case the result cannot be "horribly inefficient", since it's within a small constant factor of the fully-inlined version. > In any case, the real goal here is to see if I can safely adopt a coding style like this, or do I need to manually do all the inlining myself? The question is, will you butcher your code just because you are scared of a _potential_ performance problem, or will you write the short, readable, bug-free code first and then see if it really becomes a bottleneck? Even if the inlining is definitely needed, I would start by writing and debugging the generic version, and only then optimize it (by inlining or otherwise). -- Damien