I used a Functor for wrapping types with numbers, and then be able to change easily the representation of repositories: hash-tables, vectors, etc. This allowed me to use the right data structure for the right part of the problem without much modification of the source code. I also used that functor for creating a 'factory', making sure that each object is only represented once in the whole program, and making it cheaper to compare them.
The performance now is good enough.
However, everything is one monolitic file and I'm about to distribute in files all modules and do separate compilation.
Will I lose performance by switching from this monolitic file to separate files?
I've read in this group that Functor funcions are called always through their closures, but I suspect there maybe some optimizations when the module is available in the current compilation unit. Also, I guess I will have to a more interfaces and it may obfuscate more the modules and lower the performance.
Some other people in this group have reported inlining when using Functors in the same compilation unit. Also, some other people reported optimization across different compilation units that may be relevant to modules and functors.
I would like to know what's OCaml 3.x (x > 10) doing now.