caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Goswin von Brederlow <goswin-v-b@web.de>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Size of .cmo / .cmi workload of the compiler
Date: Thu, 20 Aug 2015 11:21:14 +0200	[thread overview]
Message-ID: <20150820092113.GB15458@frosties> (raw)
In-Reply-To: <55D4A2E4.7000303@tu-berlin.de>

On Wed, Aug 19, 2015 at 05:38:12PM +0200, Christoph Höger wrote:
> Dear all,
> 
> I autogenerate a rather large (> 12k) set of ocaml modules containing
> classes which are parameterized over their final representation to allow
> for hierarchic classes with polymorphic open recursion.
> 
> My compilation scheme seems to work well in principle, but I am reaching
> a frustrating limit in practice: The compilation of the generated ml
> files seems to run superlinear (in fact it seems to depend on the
> hierarchical location of a class). As it turns out, the generated .cmo
> and .cmi files are quite large (up to several hundreds of kb). When I
> generate the .mli files or dump the .cmo files however, the output is
> quite small (several hundred instructions in the bytecode, the .mli file
> contains quite complex objects but still human readable).
> 
> Is there any known issue that leads to:
> 
> 1. non-linear runtime when compiling inter-module classes
> 2. huge .cmo files outside of the actual bytecode
> 
> The generated source code can be found here:
> 
> https://www.dropbox.com/s/cllc0xikv9zwu1k/doesnotscale.tar.bz2?dl=0
> 
> To test the behavior, unpack and run
> 
> ocamlbuild ModelicaXX5FElectricalXX5FMachines.cmo
> 
> (there might be type-errors in the generated files somewhere, though).
> 
> Any advice or comments are deeply appreciated.
> 
> Christoph

When you inherit a class the compiler has to parse that class and
everythig it inherits. So it is no surprise to get slower the longer
your inheritance chain gets. And I assume each step in the chain adds
some method so your interface gets bigger and bigger. Sounds like the
cmi file contains the full interface and not just a reference to the
inherited class(es) and the additional code while dumping the cmo file
only shows the additional code.

MfG
	Goswin

      parent reply	other threads:[~2015-08-20  9:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-19 15:38 Christoph Höger
2015-08-20  9:12 ` Fabrice Le Fessant
2015-08-20  9:21 ` Goswin von Brederlow [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150820092113.GB15458@frosties \
    --to=goswin-v-b@web.de \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).