Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
A Question About Types and Inlining
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2006-12-08 (23:13)
From: Jim Grundy <jim_grundy@i...>
Subject: A Question About Types and Inlining
Apologies in advance for a naive question...

I'm working on a SAT solver in OCaml.  The solver has various types, 
like three-valued bools, variables, literals.  I have modules that 
encapsulate these types and the operations on them.

Now, as it turns out, all these types are represented as ints, but the 
other modules that use those types don't need to know that - and as a 
matter of taste I'd rather not expose this.

The signatures of these modules currently contain lines like this:

type variable (* = int *)

If I uncomment all instances of (* = int *) and reveal the 
representation to the compiler then I get a ... 36% performance 
improvement in the SAT solver.

I have two questions:

1/ Is there some way I can reveal this representation to the parts of 
the system that clearly need it for effective optimization, without 
opening this up for general use.

2/ Failing that, has someone got a pleasant method of doing conditional 
compilation so that I can switch these comments on and off with ease?

I'm using version 3.09.2 of ocamlopt.

Thanks in advance


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
Key Fingerprint: 5F8B 8EEC 9355 839C D777  4D42 404A 492A AEF6 15E2