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.1 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 14A23BC69 for ; Sun, 22 Apr 2007 12:04:25 +0200 (CEST) Received: from smtp6-g19.free.fr (smtp6-g19.free.fr [212.27.42.36]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l3MA4LAP027453 for ; Sun, 22 Apr 2007 12:04:24 +0200 Received: from [192.168.1.2] (che78-2-82-237-71-191.fbx.proxad.net [82.237.71.191]) by smtp6-g19.free.fr (Postfix) with ESMTP id 257BA6D523; Sun, 22 Apr 2007 12:04:21 +0200 (CEST) Message-ID: <462B3324.2050206@inria.fr> Date: Sun, 22 Apr 2007 12:04:20 +0200 From: Xavier Leroy User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Jim Grundy Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Functor Performace Question References: <461C0C71.7060709@intel.com> In-Reply-To: <461C0C71.7060709@intel.com> X-Enigmail-Version: 0.91.0.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Miltered: at discorde with ID 462B3328.001 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; functor:01 functor:01 solver:01 nat:01 nat:01 compiler:01 functors:01 functors:01 rework:01 ocaml:01 compiler:01 owing:98 caml-list:01 modules:02 types:03 > I have a functor related performance issue. > I have the following collection of modules and types that we are using > in the implementation of a SAT solver: > If we implement Nat_priority_queue in the "right" way as > module Nat_priority_queue = Make_priority_queue (Nat_map) > Then I pay about a 3% performance penalty over instantiating the functor > by hand... > Is there some compiler switch or future version in the works that will > save me from this? Basically, no. There is indeed a small performance penalty associated with functors, owing to the fact that the functor body is compiled only once without knowledge of its arguments. Late specialization of functors would be nice in the absolute, but would require a major rework of the OCaml compiler. This said, a 3% speed penalty is not too bad --- to me, it's lost in the noise of performance measurement. Regards, - Xavier Leroy