Object size?
Andy Valencia
dont at spam.me
Thu Mar 14 17:58:22 UTC 2024
On Wednesday, 13 March 2024 at 18:25:25 UTC, kinke wrote:
> This isn't LDC-specific and regularly comes up as beginner's
> topic (in general forums, try a search). One thing is that
> druntime and Phobos are linked statically by default (with
> official LDC packages at least; distro versions might not);
> with LDC, use `-link-defaultlib-shared` to link the shared
> variants. That's a pretty constant offset though, so for tiny
> hello-world programs, it might seem huge, but rest assured, it
> doesn't go on like this when the program becomes fleshier.
>
> The 2nd thing is that templates can easily lead to an explosion
> of code. Phobos' std.format is a prime and well-known example
> of that, sadly. If you use `-vcg-ast` for compiling your little
> .d, the compiler will generate a `*.d.cg` file with the
> instantiated templates. You'll see that it's almost 20k lines
> (~430 KB of source code).
Thank you! A wealth of avenues. It's particularly encouraging
that this executable growth doesn't scale with LOC--that would be
a little intimidating. I will head off and research the areas
you've listed.
Andy
More information about the digitalmars-d-ldc
mailing list