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

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jim Grundy <jim.d.grundy@i...>
Subject: Functor Performace Question
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:

module type Map = sig .. end

module Nat_map: Map with type key = int

module type PriorityQueue = sig .. end

module Make_priority_queue:
   functor (M : Map) -> PriorityQueue with type elt = M.key

module Nat_priority_queue: PriorityQueue  with type elt = int

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...

module Nat_priority_queue  = struct
   module M = Nat_map
   (* same code as the body of Make_priority_queue *)
end

Is there some compiler switch or future version in the works that will 
save me from this?

Thanks

Jim


-- 
Jim Grundy, Research Scientist. Intel Corporation, Strategic CAD Labs
Mail Stop RA2-451, 2501 NW 229th Ave, Hillsboro, OR 97124-5503, USA
Phone: +1 971 214-1709   Fax: +1 971 214-1771
http://www.intel.com/technology/techresearch/people/bios/grundy_j.htm
Key Fingerprint: 5F8B 8EEC 9355 839C D777  4D42 404A 492A AEF6 15E2